Example - Form Service Request for Adding Data

public P0115_W0115A_FormParent addPhone(){
P0115_W0115A_FormParent p0115_W0115A = null;
 
	//indicate using grid capability 
//(alternatively could use required capability)
loginEnv.getUsedCapabilities().add("grid");
 
if (AISClientCapability.isCapabilityAvailable(loginEnv, "grid"))
{
  try{
 
FormRequest formRequest = new FormRequest(loginEnv);
formRequest.setFormName("P0115_W0115A");
formRequest.setFormServiceAction("U");
 
		//open this form with specific record for AB 7500, contact 0
formRequest.addToFISet("4", "7500");
formRequest.addToFISet("5", "0");
 
FSREvent fsrEvent = new FSREvent();
//create grid action
GridAction gridAction = new GridAction(loginEnv);
//create grid row insert event
GridRowInsertEvent gri = new GridRowInsertEvent();
 
//set the column values
gri.setGridColumnValue("27", "HOM");
gri.setGridColumnValue("28", "303");
gri.setGridColumnValue("29", "123-4567");
 
//add the row to grid ID "1"
gridAction.insertGridRow("1", gri);
 
//add the grid action to the events
fsrEvent.addGridAction(gridAction);
 
//press OK button
fsrEvent.doControlAction("4");
 
//add the FSR event to the request
formRequest.addFSREvent(fsrEvent);
 
 
String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, formRequest, JDERestServiceProvider.POST_METHOD, JDERestServiceProvider.FORM_SERVICE_URI);
 
 
//de-serialize the JSON string into the form parent object
p0115_W0115A = loginEnv.getObjectMapper().readValue(response, P0115_W0115A_FormParent.class);
         }
         catch(CapabilityException e)
         {
//handle capability exception                    
            System.out.println(e.getMessage());
         }
         catch(JDERestServiceException e)
         {
		//get more specific error string
            String error = JDERestServiceProvider.handleServiceException(e);
            System.out.println(error);
         }
}
 
	return p0115_W0115A;
}