- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 08:32 AM
I am developing a record producer and form for one of our teams. On the record producer, I'd like to use a reference field for the Contact Name, and I have this code in the Default Value field: javascript:getReqfor(gs.getUserID())
It works great to pull the name of the Requested By from the Catalog into the Record Producer. However, the corresponding field on the form is a String field because when it is created directly by someone on our HR team, the person in the Contact Name field might not be someone in our system (a spouse calling about a benefit or something like that). So, I'd like it to use the reference field on the form when an Employee or Contractor uses the record producer on the CMS portal, but I'd like that field to be a string field on the Form itself.
The Contact Name that is displaying in the reference field on the record producer is populating the corresponding string field on the form with the Sys_ID instead of the Display Value. Any idea on how I can get it to resolve that Sys_ID to the referenced name?
thanks,
Richelle
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 09:32 AM
instead of write that code in default value of string field, write the same code in script field of "What it will contain" tab of Record producer. Then it should work.
Like code written above in script field.
Thanks,
Param
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 08:48 AM
Instead of map the value directly like current.string_field = producer.refernce_field_name;
Use below script :
current.string_field = producer.refernce_field_name.getDisplayValue();
Thanks,
Param
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 09:03 AM
I tried it as the default value for the field on the form, and then re-ran the record producer...it did not like that...
current.string_u_contact_name = producer.u_contact_name.getDisplayValue();
Should I set up a "Before" Business Rule?
thanks,
Richelle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 09:07 AM
Hi Richelle,
That is also an alternative. If we are using before br, then we need to query on table by sys_id and get the display value form there.
Shall I know how you are setting value in string field from reference field.
Thanks,
Param
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 09:14 AM
I created the record producer from the table and then modified the field on the record producer to be a reference field off of the User(sys_user) table. I then added the default value to the field on the record producer that pulls the "Requested For" into the field. On Submit, the record producer sends the sys_id of that "Requested For" person into the corresponding String field on the form.
On Record Producer:
On HR Form (with your suggested code in the default value):