The CreatorCon Call for Content is officially open! Get started here.

How to set dynamic default value for a variable in a record producer

Mohammad8
Kilo Expert

Hello,

I have a table and I created a record producer that maps to it. Once of the variables in the record producer which maps to a column in the table is of type Reference and it refers to table "HR Profiles".

What I need is to set the default value of this variable to the HR Profile that is linked to the currently logged user.

I read some articles about implementing this using Catalog Client Script or by making use of the "Default Value" field of the variable, but I couldn't do it.

All suggestions are highly appreciated.

1 ACCEPTED SOLUTION

Alikutty A
Tera Sage

Hello Mohammad,


On the default value field of your reference variable, just mention the SYS ID of your HR profile.

If you need to fetch the SYS_ID, then you need to write a script include that returns the Sys ID and place it in as default value. For eg

Default value will be

javascript: new HRUtils().getHRProfile(gs.getUserID())

where HRUtils will be your script include and

and getHRProfile is its function that returns the HR profile Sys Id of current user.

 

Thanks!

View solution in original post

4 REPLIES 4

Allen Andreas
Administrator
Administrator

Hi,

What have you tried and what do you mean you couldn't do it?

First step would be for us to understand what you've done to assist with troubleshooting or perhaps explaining something.

It would be a waste of time for one of us here to type out a possible solution when it's that very same solution you "couldn't do".

Hopefully I make sense, but we're all about learning here so we want to learn from you, what you've done, then help you learn how to do it correctly.

🙂

Thanks!


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

Alikutty A
Tera Sage

Hello Mohammad,


On the default value field of your reference variable, just mention the SYS ID of your HR profile.

If you need to fetch the SYS_ID, then you need to write a script include that returns the Sys ID and place it in as default value. For eg

Default value will be

javascript: new HRUtils().getHRProfile(gs.getUserID())

where HRUtils will be your script include and

and getHRProfile is its function that returns the HR profile Sys Id of current user.

 

Thanks!

Thanks Alikutty K.

This worked for me.

Is there a way to do this for consumers in CSM? looking at the consumer's name