- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 06:14 AM
Hi All,
I have a custom reference field on the sc_request form called "reply to". This reference field selects from sys_user table and the reference key is "email". So the user is asked to select/enter an email address into the "reply to" field.
My question is: If the email address they enter into "reply to" does not exist in the sys_user table, I want a new user record created with that email address. To do this, I think I go to the Dictionary for the "reply to" reference field and on the advanced view, I set the field "Dynamic creation" to true and I need to provide a Dynamic creation script. This is where I get stuck. What is the script needed to create a user record where I only know the email address they enter in the "reply to" field?
In the doc it shows the example of a dynamic_creation_script as:
current.name = value;
current.insert();
That alone does not work. what is 'name' and what is 'value'
The field on my form is "reply to" that I want to make to the "email" field on sys_user.
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 07:32 AM
hi Chandu,
I figured it out. Script include isn't necessary.
The user record will create automatically.
You can tell the creation_script field which fields to populate.
in this case, the "value" is the text they entered into the reference field that doesn't currently match and record in the user table.
Here you can select which field to place into sys_user as current.email, current.user and current.name.
In my case I want 'value' which is coming from my custom field u_reply_to to populate email user_name and name in the user record but I could also populate other fields in the user form directly in this creation script.
current.email=value;
current.user_name=value;
current.name=value;
current.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 07:19 AM
Hi
You may call script include and check the user is available in user table or not if not create user in user table
Please make this answer is correct if answer your question
Thanks
Chandu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 07:32 AM
hi Chandu,
I figured it out. Script include isn't necessary.
The user record will create automatically.
You can tell the creation_script field which fields to populate.
in this case, the "value" is the text they entered into the reference field that doesn't currently match and record in the user table.
Here you can select which field to place into sys_user as current.email, current.user and current.name.
In my case I want 'value' which is coming from my custom field u_reply_to to populate email user_name and name in the user record but I could also populate other fields in the user form directly in this creation script.
current.email=value;
current.user_name=value;
current.name=value;
current.insert();