Remember when you pass "" into a function this is not considered null
so try this
if(STATUS_1 != null && !STATUS_1.equals(""))
{
formaentry.put(7,new
Value(STATUS_1));
}
Do this for all comparisons.
String a = null; //this is a null string
String a = ""; //this is a string that is not null but is empty, you
will create a String class.
On Jun 17, 11:27 am, "Garrison, Sean (Norcross)"
<[email protected]> wrote:
> When doing a setEntry you do not have to put every field in there. I have
> seen where programmers will do a "genEntry" and use the results to do a
> "setEntry". Unfortunately the "getEntry" sometimes includes fields like
> "Submitter" and "Create Date" that do not need to be updated. In addition
> doing "Put" statements only add two status fields in the list instead of 1.
> Here is what I would suggest:
>
> public static String createRecordReplace(String Folio, String submitter,
> StringACTIVIDADES_1, String STATUS_1, String FOLIO_P_1, String FECHA_AT_1)
> {
> String entryIdOut= "";
> int campos[];
> campos = new int[4];
> campos[0]=536870934;
> campos[1]=7;
> campos[2]=536870954;
> campos[3]=536871019;
> try
> {
> entry = userInfo.getEntry("FORM",Folio,campos);
> formaentry = new Entry();
> if(ACTIVIDADES_1 != null)
> {
> formaentry.put(536870934,new
> Value(ACTIVIDADES_1));
> }
> if(STATUS_1 != null)
> {
> formaentry.put(7,new Value(STATUS_1));
> }
> if(FOLIO_P_1 != null)
> {
> formaentry.put(536870954,new
> Value(FOLIO_P_1));
> }
> if(FECHA_AT_1 != null)
> {
> formaentry.put(536871019,new
> Value(FECHA_AT_1));
> }
> userInfo.setEntry("FORMA", Folio, formaentry, null,
> 0);
> System.out.println("Success.");
> }
> catch (ARException e)
> {
> ARExceptionHandler(e," Problem");
> }
> }
>
>
>
> -----Original Message-----
> From: Action Request System discussion list(ARSList)
> [mailto:[email protected]] On Behalf Of Guillermo Alfredo Torres Barron
> Sent: Thursday, June 16, 2011 5:40 PM
> To: [email protected]
> Subject: Problem with JAVA API
>
> Hi dear listers
> I try to modify a ticket from java api program, the program will modify some
> fields in determinate registry with a entry-id proportionate for the user,
> and not all fields will be modified at the same time, but I run my class
> appear the next error
>
> # ./ejecutar APImod "00000000002" "documentation in this moment " "" "" ""
> Problem.
> Message type: Error
> Status List:
> Required field cannot be reset to a NULL value
> 7
> The field is a core system field and cannot be changed
> 1
> Stack Trace:ERROR (326): Required field cannot be reset to a NULL value; 7
> WARNING (52): The field is a core system field and cannot be changed; 1
> at com.bmc.arsys.apitransport.ApiProxyJRpcBase.verifyStatus(Unknown
> Source)
> at com.bmc.arsys.apitransport.ApiProxyJRpcBase.a(Unknown Source)
> at com.bmc.arsys.apitransport.ApiProxyJRpcBase.arCall(Unknown Source)
> at com.bmc.arsys.api.ProxyJRpc.ARSetEntry(Unknown Source)
> at com.bmc.arsys.api.ARServerUser.setEntry(Unknown Source)
> at APImod_CASSCA.createRecordReplace(APImod
>
> But I don't want to change field 7 and 1
> My source code is
>
> public static String createRecordReplace(String Folio, String submitter,
> StringACTIVIDADES_1, String STATUS_1, String FOLIO_P_1, String FECHA_AT_1)
> {
> String entryIdOut= "";
> int campos[];
> campos = new int[4];
> campos[0]=536870934;
> campos[1]=7;
> campos[2]=536870954;
> campos[3]=536871019;
> try
> {
> entry = userInfo.getEntry("FORM",Folio,campos);
> if(ACTIVIDADES_1 != null)
> {
> entry.put(536870934,new Value(ACTIVIDADES_1));
> }
> if(STATUS_1 != null)
> {
> entry.put(7,new Value(STATUS_1));
> }
> if(FOLIO_P_1 != null)
> {
> entry.put(536870954,new Value(FOLIO_P_1));
> }
> if(FECHA_AT_1 != null)
> {
> entry.put(536871019,new Value(FECHA_AT_1));
> }
> userInfo.setEntry("FORMA", Folio, entry, null, 0);
> System.out.println("Success.");
> }
> catch (ARException e)
> {
> ARExceptionHandler(e," Problem");
> }
> }
>
> How can I modify a field only the user sends the corresponding value for the
> field???
> We have AR Server 7.6.03, O.S. Solaris 10, Oracle 11g.
> Thanks in advanced
> Greetings from Mexico City
>
> Este correo electronico es confidencial y/o puede contener informacion
> privilegiada.
> Si usted no es su destinatario o no es alguna persona autorizada por este
> para recibir sus correos electronicos, NO debera usted utilizar, copiar,
> revelar, o tomar ninguna accion basada en este correo electronico o cualquier
> otra informacion incluida en el, favor de notificar al remitente de inmediato
> mediante el reenvio de este correo electronico y borrar a continuacion
> totalmente este correo electronico y sus anexos.
> Nota: Los acentos y caracteres especiales fueron omitidos para su correcta
> lectura en cualquier medio electronico.
>
> This e-mail is confidential and/or may contain privileged information.
> If you are not the addressee or authorized to receive this for the addressee,
> you must not use, copy, disclose, or take any action based on this message or
> any other information herein, please advise the sender immediately by reply
> this e-mail and delete this e-mail and its attachments.
>
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives atwww.arslist.org
> attend wwrug11www.wwrug.comARSList: "Where the Answers Are"
>
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives atwww.arslist.org
> attend wwrug11www.wwrug.comARSList: "Where the Answers Are"- Hide quoted text
> -
>
> - Show quoted text -
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug11 www.wwrug.com ARSList: "Where the Answers Are"