Attention! 1. This action is only available in Bitrix24 Self-hosted version.
2. Only a user with administrator’s rights can set PHP code.
Note: The code must be indicated with no opening or closing tags (<?, ?>).
Action Parameters
Since the meaning of most fields is clear from their names, their description is omitted.
Examples of application
Setting a value for the variable
$this->SetVariable('Variable1', 12345);
where:
Variable1 – identifier of the variable to which a value will be assigned (12345 number).Entering several users to the User type variable
$this->SetVariable("user", array("user_1", "user_2"));
where:
array("user_1", "user_2") – an array of users in the formatuser_[user_identifier_in_the_system]
. The use of PHP code and values of fields/variables to obtain the name of the infoblock element
$arFilter = Array("IBLOCK_ID" => {=Variable:Variable1_printable}, "ID" => {=Document:PROPERTY_1}); $dc = CIBlockElement::GetList(array(), $arFilter, array("NAME")); $br = $dc->Fetch(); $Pbrr = $br["NAME"]; $this -> SetVariable('Variable2', $Pbrr);
where:
{=Variable:Variable1_printable} – value of the variable containing the infoblock identifier;
{=Document:PROPERTY_1} – field of the document containing the infoblock element identifier;Variable2 – identifier of the variable which will be assigned the calculated name of the infoblock element.
Conversion of the document field format and its further use
Let us consider an example of conversion of the document field User to an understandable form in order to use it when sending a message:
- A variable to store the converted value of the document field should be created in the business process template;
- Let us indicate the following in the PHP code action:
$rsUser = CUser::GetByID({=Document:PROPERTY_USER}); $arUser = $rsUser->Fetch(); $this->SetVariable('#Variable_name#', $arUser[NAME].' '.$arUser[SECOND_NAME].' '.$arUser[LAST_NAME]);
- After that, we have to use the result of this variable instead of the document field in the block used for notification.
Action Parameters
Mode:
- Period – indicates the time period after which the business process will be resumed;
- Time – indicates the specific time for resuming the business process.
Pay attention to this action. It permits you to significantly save labor resources by using standard action blocks when creating a business process template. Once created and set up, the action block can be saved in the group My Actions and used repeatedly.
Action Parameters
Type:
- any – random selection of a regular employee;
- supervisor – selection of a supervisor for the indicated employee.
Note: The supervisor selection option is used only in the product Bitrix24 Self-hosted.
From users – indicates users or groups from which one employee will be selected.
For user – indicates the user for whom a supervisor will be selected.
Supervisor Level (the more the higher) – selects the level of a supervisor for the indicated user.
If no Supervisor is determined, send to – indicates the users who will be selected in case it is impossible to select from the main users indicated above. For example, if the group indicated in the field From users contains no employees, someone from among reserved users will be selected.
Escalate to higher level if absent – permits you to automatically omit absent employees, for example, if they are on vacation.
If it is impossible to select the main supervisor, for example, if they are on vacation, and the option Escalate to higher level if absent is equal to Yes, the action will automatically continue selecting a supervisor but of a higher level. If the top level supervisor is also unavailable, the selection will be effected from among the employees indicated in the field If no Supervisor is determined, send to.
If the option Escalate to higher level if absent is equal to No, the action will terminate and, notwithstanding the absence, a supervisor of the relevant level will be selected.
If all supervisors are unavailable or the employee has no supervisor, the action will return an empty value.
Action Results
The results of this action can be obtained using the form Insert value - Additional results where they will be available immediately after adding the action to the template.
The following is available:
- Selected Employee.
Entries to the report can be conveniently used, for example, during business process debugging to save the data of a necessary stage to the report.
Action Parameters
Load log for use by business process – permits you to obtain the contents of the entire report as a part of a business process for further actions (e.g., sending by email) by using the form Insert value, the Additional results section. Otherwise, the report data will be impossible to obtain as a part of a business process and will be available only in the log.
The option Load log for use by business process can be useful at the stage of the completion of a business process in order to generate a final report without making excessive queries to the base.
Action Results
The results of this action can be obtained using the form Insert value - Additional results where they will be available immediately after adding the action to the template.
The following is available:
- Log;
This action permits establishing the rights of access to the document.
Action Parameters
"..." permission is granted to – setup of rights of the document for the indicated users/user groups.
If the document uses simplified (old) version of rights, they are set strictly from the outside (access settings to infoblocks/lists/etc.). The only option that permits establishing rights directly from the business process consists in establishing business processes rights for the document from the outside. In this case, it is possible to change rights during the execution of the process using the tab Access or the action Set Permission.
If extended rights of access are used, only new rights to the document can be added from the business process; the document will keep these rights even after the process is completed. The rights established from the outside cannot be redefined inside a business process.