Requested For location

harish11
Mega Expert

I have custom requested for field (Column name: u_request_user) on our task forms and i have created another custom field for location (Column name: u_requested_for_location).

On task forms, am trying to set the field to load, when a task is created. Can someone help with the script please.

1 ACCEPTED SOLUTION

current.location = current.variables.requested_for.location.sys_id;


View solution in original post

8 REPLIES 8

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could do this with an insert business rule on the task that grabs the requested for from the request and adds it to the task along with the location.



That being said, why are you adding fields to the task rather than just showing the derived field from the request on the task form?


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Harish,



You can dot-walking to the reference table and pull the fields. More info here.


http://wiki.servicenow.com/index.php?title=Dot-Walking



Please let us know if you have any questions.


Hi Guys,



Any chance if you can help with this. I have been trying to populate the 'Location' field with the Requested for location, on the Request task form with a simple BR. But for some reason, the field continues to remain blank. Location field is pulled off the task table and have the same field on my incident form as well.




The rule i have set is:


Set Location same as 'Requested For' location. Have also tried,


Table: Catalog Task


Rule: Current.location = current.variables.requested_for.location.getDisplayValue();



Have checked for any default rules which might be stopping this being populated. Any idea what I could be missing.


current.location = current.variables.requested_for.location.sys_id;