get field value for condition builder

chadlockwood
Kilo Sage

There is a field on my form that will have a randomized code. When the overall action is complete, that randomized code will be written to a string field on a user record.

On the same form is a condition builder linked to sys_user. This condition builder should identify user records that do not contain the value of the randomized code field.

The field is called Name Code (u_name_code). The field on the user record is User Actions (u_user_actions).

I want the condition criteria to be something like:

User Actions | does not contain | javascript:gs.getValue('u_name_code');

Needless to say, this does not work.

Is it possible to use javascript to get a value on a form and enter it into the condition builder criteria?

Thanks,

Chad

5 REPLIES 5

Subhajit1
Giga Guru

This is the perfect situation wherein you will use a Script Include and invoke the Script Include Function to return the values.



You will have to pass the current.u_name_code value to your SI function, query the sys_user(u_user_actions field) table using the value and return the result set that doesn't contain this value.



This should look something like this:-



javascript:new myScriptInclude().my_FunctionName(current.u_name_code)


Subhajit,



My intention is to use the value of the condition builder as an encoded query in other functions. So I will have a function that looks at this record, then uses the condition builder value to query user records. This is why I need to pull the value of the name code into the condition builder. Are you saying that I need to use a script include to reach back into the current record and return the value of the name code field? If I can pass current.u_name_code out to a script include, why couldn't I just pass that directly to the condition builder?


Sorry, did not understand the scenario. Would you be able to describe it with an example?


In regards to onboarding...


Now that people are recognizing the value of automation in our onboarding process, I am receiving numerous requests for "add full time employees to this group" or "all contractors should have this code". Instead of shoehorning individual updates into my workflow, I decided that I would create a utility table where each record was a kind of rule that would be applied to appropriate records. Once the action was processed against a user record, that record would be tagged so that the action would not run again.


The first rule I am attempting to create is to add all new Full Time employees to a collection of groups. The record has a string field that will contain a comma-separated list of Active Directory groups. There will be an activity in our onboarding workflow that will look for this rule, then do a GlideRecord query against sys_user to identify all of the user records that match the criteria in the condition builder. This includes identifying records that have not already been tagged with the name code from the rule record. Once those records have been identified, the workflow will add each user to each group, then tag each user record with the name code.


To accomplish this from the workflow, I would like the condition builder to include a "does not contain name code" so that the workflow activity can just run the encoded query against the user table.



I hope this makes sense.