How to dot walk in Ui Action

pratik_kumar
Giga Expert

Hi All,

How can we dot walk the fields of a RITM form, from approval table record .

Like in my instance there is field call"Title" I want to dot walking this field from ui action on approval table.

Regards,

Pratik Kumar

6 REPLIES 6

Alikutty A
Tera Sage

Hi,



Please use this line of code in your UI Action on approval table



If title is a field on requested item table then use  


current.sysapproval.title;   //Title is the field name on your RITM



If title is a variable on requested item table then use  


current.sysapproval.variables.title;   //Title is the variable name on your RITM




Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


Hi



As i have mentioned this UI action is on approval table.


find_real_file.png


we are taking ritm number and approver using g_form.


if i am using "current.sysapproval.title;" , i am not able to click button.



Kindly suggest


The code will work if you are changing the script fully to server side using current object. Is it possible?



You can also mix client and server code in a UI Action: http://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/



Or else you can try this but it is always better to use Glide Ajax for such cases.



var ritm = g_form.getReference('sysapproval');


var title = ritm.u_title;     //ritm.variables.title whichever matches your variable name



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response





amlanpal
Kilo Sage

Hi Pratik,



I believe the 'Title' is a field in your RITM form and the UI action is in the Approval table (sysapproval_approver). If this is correct, then you can do dot walking via the OOB field 'Approving for' (sysapproval). In your scenario, it will be like current.sysapproval.u_title (considering the name of the 'Title' field is 'u_title').


If the UI action in the Group Approval table (sysapproval_group), you need to do dot walking via 'Parent' (parent) field. this time you need to do as current.parent.u_title.



I hope this helps.Please mark correct/helpful based on impact