Auto Populate Fields using Requested For

Blaze2
Kilo Guru

I have created the following Catalog Item and Form. The idea is for the Training group to fill this form out for new employees.

Currently the Employee Name field will auto populate all of the required fields.

Form.JPG

using the following Client Script:

client script.JPG

When I get to the Request and Requested Item, the name that is populated as the Requested for is mine. Request.JPG

So I went back to the form, and added the Requested By Variable Set which of course will not populate the needed fields.

Requested for.JPG

My question is to have one of the following occur:

1. Keep the Employee name field which will populate everything as it is now, but also have the name inserted there be the Requested for

2. Change the variable from Employee_name to Requested_for, have it populate all fields and show as the Requested for.

Either option is good for me.

Thanks for your help.

1 ACCEPTED SOLUTION

Blaze2
Kilo Guru

I figured it out.



I needed to change the field name from employee_name to requested_for.


find_real_file.png



Then in the Client Script I did the same




find_real_file.png



This would give me the functionality that I needed.
1. to Auto Populate the Fields I needed. find_real_file.png



As well as Bring forward the Employee Name as my Requested for in the Request. RITM and the SCTASKfind_real_file.png



Thanks everyone for your help


View solution in original post

16 REPLIES 16

Uncle Rob
Kilo Patron

When it comes to request items, variables don't auto-magically do anything in determining requested for.  
If I want to precision control this, I typically do so in a Run Script in the very first activity of whatever workflow I'm firing.


I understood that it would not do it automatically, I guess my request is for someone to assist with the framework of what that script would look like.




OR



Explain to me   how to get my Employee Name variable to populate the Requested for Field in the Req, RITM and SCTask


Well, OOB the Requested For field doesn't exist in RITM or SC_Task.   It only exists at Request.



So the script within the workflow would look something like this...


current.parent.requested_for = current.variables.employee_name (or whatever you called it)



When running scripts inside a workflow, current is always your Requested Item.   From there you need to dot walk up parent to get to the Request, then adjust the Request's "requested_for" field.   As a neat side effect, Opened_By will always keep track of "who actually hit save".


I am not sure as to where exactly to put this.



Can you take a screen shot of how you would place it? Sorry for the bother, just want to make sure that I get it correct.


In the workflow builder, open the Workflow that the Requested Item would trigger, add a "Run Script" activity just after the Begin activity, then place the script I wrote you.   Make sure   your activities are linked up nicely and you're good to go.