How to set assignment group OR get assignment group in flow designer

Alex Hadleigh
Tera Expert

Hi All, 
We have a subflow which looks at our certificates and checks if any have expired or are close to expiring. If there are certificates in this state then an incident is created. 
it is currently set up to use the input > certificate ci > assignment group to fill the assignment group field on the incident record. However, not all certificates have been updated to contain an assignment group. Therefore incidents are being created which have no assignment group and therefore could be missed/lost and a certificate could expire without anyone knowing. 
Therefore, I am trying to edit the flow to fill the assignment group field using either the assignment group from the certificate ci OR use a default group which will look after certificates if not assigned to another group. In this case it is called 'Service Operations' 
I have tried to script this request but haven't had much luck so far. It appears what I have coded is now preventing an incident being created all together. 
I haven't done any coding in flow designer so I am a bit lost, any help would be amazing. 

find_real_file.png

Thanks

Alex

1 ACCEPTED SOLUTION

This is the code that worked in the end:

find_real_file.png
Thanks 
Alex

View solution in original post

4 REPLIES 4

Allen Andreas
Administrator
Administrator

Hi,

You can use something like this:

if (fd_data.trigger.certificate_ci.assignment_group) {
return fd_data.trigger.certificate_ci.assignment_group;
} else {
return gs.getProperty('name_of_property');
}

Then you can create a system property as string to house the sys_id of the Service Operations group.

The above assumes your fd_data.trigger... is correctly formatted (I just used what you supplied). You can dot-walk to this by typing fd_data. and you'll see the referenced data show up and continue to dot-walk to get you where you need to go.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen, Thanks for your reply. 

Would the if statement always evaluate to true here? as even if the result is empty there is still that field on the record that is being looked at. 

Thanks

Alex

This is the code that worked in the end:

find_real_file.png
Thanks 
Alex

Hi @Alex Hadleigh 

I felt my reply would have guided you Correctly, as that was the goal and not trying to give you literal code, that's something you can handle on your side. I'm unsure if you actually tried my suggestion first.

In any case, if the trigger.certificate_ci.group blah blah was retrieved and resulted in null/empty, undefined, it would not pass that if check and result to else. That's standard javascript type outcome.

Then, the goal was to not hard code the sys_id and associate it to a system property and go from there.

It seems you've marked your own reply as Correct. All questions on the forums posted by someone who then eventually gets guided Correctly, would have their own outcome as Correct, thus none of our replies would be "Correct".

In any case, if that's what worked for you, then great, if my reply helped guide you...Correctly, please mark that as Correct. As it was about the guidance, not the literal code, but...it's your post 😉

Take care!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!