The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Fetching the Reference field's other column values in a UI ACTION

amit_bhatia
Kilo Explorer

Hello Everyone,

 

I need to pass on a Reference field's another column value to some web service from a UI action.

 

var oCountry = g_form.getReference('country');

gs.log('Object:' || oCountry,'WSCL');

gs.log('Shot name' || oCountry.u_short_name,'WSCL');

 

country is a reference field on my form, u_short_name is another column on country table. I am looking to post this value to a web service. This code is under a UI action.

 

Does getting the ref. with g_form works in UI action?

 

Please help!

5 REPLIES 5

Makosko
Tera Expert

Amit,



If i remember correctly, you can only pass string values to a web service function. What you may want to do is to retrieve the required parameter values first and then feed them into your web service call.



As for the g_form object, it is a client-side object and can be accessed if your UI action has the Client field checked.



hope that helps ?



Cheers


Maros


Kalaiarasan Pus
Giga Sage

it would be appropriate to use a server side ui action for this.... dot walking directly on the reference field will give you the values needed...



And if I am not wrong , you will eventually use some server side script to call the web service... so why not use a server side button


var sMsg = new SOAPMessage('Customer Lookup', 'lookupCustomer');


sMsg.setStringParameter('TransactionID','sys12345_07102014');


sMsg.setStringParameter('RequestID','sys12345_07102014');


sMsg.setStringParameter('SourceSystem','USM');


sMsg.setStringParameter('Timestamp','2014-10-02T21:32:52');




//var oCountry = g_form.getReference('country');


//gs.log('Object:' || oCountry,'WSCL');



gs.log(current.country.u_short_name,'WSCL'); -- Can we dot walk like this? Country is a reference field here.




sMsg.setStringParameter('CustomerName',current.name);


sMsg.setStringParameter('IndustryCode','T&T:TELECOM');


sMsg.setStringParameter('SICCode','TELECOMMUNICATE');


sMsg.setStringParameter('ReturnDPL','true');


var response = sMsg.post();


//gs.log(response, 'WSCL');


Yes, if it is a server-side UI action...