ATF: Set field values using a Server side script to a catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2018 02:43 AM
I am trying to set field to a catalog item using a server side script.
Catalog name: Onboarding.
i am trying to set the fields "Type of facility access" and "Type of it cluster" which is dependent on the "on boarding location".
PS: I am new to scripting.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2018 05:37 PM
Can you include what you've tried specifically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2018 11:12 AM
Is there any particular reason you need to use a server side script for this? I would recommend using a Client side onChange rule.
Assuming you can use a Client side script:
First you would want to set the Field Name to the "On-boarding Location" field.
For the Type field, select onChange.
(Note: If the end user will be filling this form in the Portal view, be sure to allow that with the UI Type Field)
Try using this script and substituting the words within the brackets "[]", with the back end value for the text within. Make sure to include the quotes and remove the brackets as well in the script field.
if(newValue == '[On-boarding Location 1]'){
g_form.setValue('[Type of facility access variable name]' , '[desired variable choice]')
g_form.setValue('[Type of IT cluster]' , '[value]')
}
else if(newValue == '[On-boarding Location 2]'){
g_form.setValue('[Type of facility access variable name]' , '[desired variable choice]')
g_form.setValue('[Type of IT cluster]' , '[value]')
}
else if(newValue == '[On-boarding Location 2]'){
g_form.setValue('[Type of facility access variable name]' , '[desired variable choice]')
g_form.setValue('[Type of IT cluster]' , '[value]')
}
//in the case where 2 On-boarding locations set the same values you would write the if statement like this:
else if(newValue == '[On-boarding Location 3]' ||newValue == '[On-boarding Location 4]' ){
g_form.setValue('[Type of facility access variable name]' , '[desired variable choice]')
g_form.setValue('[Type of IT cluster]' , '[value]')
}
***End of Code***
You can repeat this as may times as needed depending on how many choices are in the On-boarding Location field.
As the Type of IT cluster field is read-only, I'm unsure what value it needs to hold. In most cases, it would be the back end value for the choice associated with that variable. However, if it is a reference field it would need a sys_id.
Note: Please mark reply as correct / helpful if it answers your question.
Let me know if you need anything else!
Trent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2018 07:56 PM