HEllo All, I want to send email to a specific empl...
# suitescript
v
HEllo All, I want to send email to a specific employees. I need to do it thru script parameters. But i dont know how to do it as this is my first time. could anyone please help me?
b
v
Hi @battk
when clicking a button , i call the function from UE to CS. then it checks a field as well sending the mail notification. so i need a record Id to check the field which i am sending as a parameter. for sending the email, i need the recipient id as the script parameter. but the getparameter does not return the value. what should i do?
b
that doesnt sound like a script parameter
a script parameter is a field on the script deployment
it can also be a field on the company preferences or rarely the user preferences
v
this getparameter does not return any value
b
did you create the field?
v
no, i created a script parameter only
b
what does the script parameter look like
it should be a field somewhere
v
message has been deleted
this is my script parameter created thru the UE Parameters subtab which is reflecting in the deployment record.
b
you should be able to get the value from the user event script after you a value in that field
v
no i could not get the value of the field.
Copy code
{
  "id": "customscript_ue_button_isabel_status",
  "deploymentId": "customdeploy_ue_button_isabel_status",
  "logLevel": "DEBUG",
  "bundleIds": []
}
this is what i am getting logging the whole script record.
b
script parameters arent going to be logged on the script object
v
sorry for the inconcenience, now i get the script parameter vamue
now i need one more help. how can i pass that parameter to the email.send function in CS script from UE ?
b
easiest is going to be to set a field on the record to use from the client script
you can also set the emails as a function parameter in the functionName of your button
v
but i used the functionName to send the record id to check the field.
can i use a function inside a function?
b
you can have multiple parameters to a function
v
how can i send multiple parameters in this ? i have two parameters recordId and noticeTreasuryRecipients.
functionName : 'noticeTreasury(' +newRecordId+ ',' +noticeTreasuryRecipients+ ')'
is this correct? if not please let me know
b
fair chance the answer is no
but it depends on what value is in noticeTreasuryRecipients
you need to know how eval works to understand what is being run
v
its id of the employee.
b
specific answers for newRecordId and noticeTreasuryRecipients will be needed
v
you need to know how eval works to understand what is being run ---> this one i dont understand
b
your code is bad enough to sometimes work and sometimes not depending on the values of your variables
v
ok
e
Create a script parameter of free form text type and then in your deployment put the value in this format : ["user@email.com", "user2@email.com"] and then on your email.send assign the value of the script parameter to the recipients property after you retrieve the script parameter.
v
Thank you @battk Thank you @Eric B
in the script parameter, i am adding two ids. the first id is getting the mail, but the second id is not getting the mail.
b
still need to share the actual values, as i said before, your code will work sometimes and not others depending on the values