- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 09:05 AM
Hi All,
I need to auto-populate a specific assignment group on Incident table when a new record is being raised and when environment of non-prod is selected. I did the second part - populating the assignment group when env=non-prod and clearing it otherwise. However, I am not sure how to add condition that this should happen only for new records, i.e. if the record already exists/has been raise, we should be able to re-assign the ticket to any other team.
My current onChange (field: environment) client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var env = g_form.getValue('u_environment');
if (env == 'Non-production') {
g_form.setValue("assignment_group", "a4f63ac36ffb2100dbb7db141c3ee4a6");
}
else
{
g_form.setValue("assignment_group", "");
}
}
Does anyone have ideas of how I could add the condition? I think I need to be using isNewRecord(), but not sure how exactly to plug it in.
Any suggestions are appreciated!
Thank you,
Kamile
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2016 09:14 AM
Hi Kamile
For the new record? Do you simply want to check if this form is going to create a new record in the incident table? In that case you can just use
if(g_form.isnNewRecord()){
do whatever you need it to do
}else{
do something else
}
or in your specific case you could add it to the original if statement
if (g_form.isNewRecord() && env == 'Non-production') {
But if you are wanting to check if the same type of record has already been created, then it's a much more complicated process.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2023 12:14 AM
Use g_form.isNewRecord() in client side code.
Please mark correct if its helpful