Dynamic Value on Template

Al-JhonV
Kilo Sage

Hello Everyone, I just want to ask if there is a way to set a dynamic value on a template.

Table: SC_TASK
Auto fill Assignment Group and Assigned To field.
Since there is no operator on assigning value on fields, maybe a script can do but gs.getUserID() is not working

Tried script:

javascript:gs.getUserID()
gs.getUserID()
gs.getUserID();


No luck.

Anyone got an idea?

AlJhonV_0-1776303353168.png

 

2 REPLIES 2

Vaibhav Chouhan
Tera Guru

Templates do not support dynamic values like gs.getUserID, so you cannot directly set Assigned To or Assignment Group based on the logged-in user using a script inside the template.

A good workaround for this is to use a placeholder value in the template and then handle it using a client script. You can set a dummy value in the Assigned To field in the template, and then use an onChange client script to check if that value is the dummy value. If it matches your placeholder, you can replace it with the logged in user using g_user.userID.

This way, the template handles the initial value, and the client script makes it dynamic.

Mark Manders
Giga Patron

Templates are used to set data that is always the same, based on the template. You can use a client script to set the current user as assigned to, after creation of the sc_task. 

Do know that manually created tasks could break any automation that is on your service requests.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark