Choose where you’d like to start

Assign profile to app user

Note: This task is applicable only to Zoho Creator.

Overview

This deluge task assigns a specified profile to specified users.

Note: If the email address does not correspond to an existing user then a new user will be added and the profile will be assigned.

Return

This task returns a MAP value in the format {"profileName":"<specified_profile>","emailId":"<specified_email>"}

Syntax

<variable> = thisapp.permissions.assignUserInProfile(<email_ID>, <profile_name>, <notification>);

ParamData typeDescription

<variable>

(optional)

KEY-VALUEVariable which will hold the returned value.
<email_ID>TEXT

Email id of the user to whom the profile must be assigned.

Points to note for this parameter:

  • You can specify multiple email addresses in a list format.
  • If the specified user does not exist in the app, the new user will be added with the specified profile.  
  • You can view the email addresses of existing users in you account from the Account Setup page, and existing users in the application from the Users page.
<profile_name>TEXT

Name of the profile which needs to be assigned to the specified user.

Points to note for this parameter:

  • If the specified profile does not exist, execution of the script will stopped during runtime and an error message will be displayed. 
  • You can view the existing profiles in your app in the Permissions page.

<notification>

(optional)

BOOLEAN

Decides if an email invitation to join the organization needs to be sent when the specified email address doesn't correspond to any of the existing users. If this param is true, an invitation to join the organization will be sent to the specified email address. Otherwise, the mail will not be sent.

Default value: false

Note: In Zoho Creator Custom Solutions, an invitation will always be sent to the specified email address irrespective of the value of this parameter.

This task can be used in the following events

When a record is Created
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Created or Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Deleted
On ValidateYes
On SuccessYes
Other workflow events
On a scheduled dateNo
During approval processYes
During payment processYes
In a Custom FunctionYes
In an Action item in reportYes

Example

1. A sample snippet assigning "Read" profile to a user.

thisapp.permissions.assignUserInProfile("john@zylker.com", "Read");

 

2. A sample snippet assigning "Write" profile to a user and sending an email notifying the same to them.

thisapp.permissions.assignUserInProfile("portia@zylker.com", "Write", true);

Get Started Now

Execute