# SQL Integration flows - Update user

## Update user

### Introduction

Soffid provides a workflow to create, modify, and delete a user in the final system. One can see the steps of the process in the following diagram.

This process only applies to account type single users.

### Diagram

[![image-1659448091093.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1659448091093.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1659448091093.png)

### Step by Step

In this document, we will explain the process that Soffid performs to modify a user for the SQL connector.

#### 1. Initial step

First of all, Soffid checks if the user exists in Soffid and then checks the operation to perform, update or delete.

**1.1.** If the **user does not exist in Soffid**, then Soffid asks to delete the user in the target System.

<details id="bkmrk-%E2%9D%93-warning-message"><summary>❓ Warning message</summary>

![image-1659534714096.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1659534714096.png)</details>**1.1.1. Yes**: If the answer is Yes, the process follows through the Yes branch,[ \[3. Delete branch\]](https://bookstack.soffid.com/books/connectors/page/ad-integration-flows-update-user#bkmrk-4.-delete-branch).

**1.1.2. No**: If the answer is Yes, the process finishes [\[10. End\]](https://bookstack.soffid.com/books/connectors/page/ad-integration-flows-update-user#bkmrk-x.-end).

<div class="pointer-container" id="bkmrk-%C2%A0"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>**1.2.** If the **user exists in Soffid**, the process continues through \[[2. User to remove?\]](https://bookstack.soffid.com/books/connectors/page/ad-integration-flows-update-user#bkmrk-2.-user-to-remove). to check if the

#### 2. User to remove?

<details id="bkmrk-by-clicking-on-the-u"><summary>📌 By clicking on the User to remove? step,...</summary>

You can configure all the properties related to the user object for this step. [![image-1660224430017.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660224430017.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660224430017.png)

</details>**2.1.** If the user is **marked for Deletion**, Soffid will ask for user consent to continue with the process or to cancel it. If the answer is Yes, the process follows through the Yes branch, <span style="background-color: #c2e0f4;">[\[3. Delete branch\]](#bkmrk-4.-delete-branch)</span>.

<details id="bkmrk-%E2%9D%93-warning-message-0"><summary>❓ Warning message</summary>

![image-1659534714096.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1659534714096.png)</details>**2.2.** If the user is **marked for Update**, it continues with the flow following through the No branch, <span style="background-color: #c2e0f4;">[\[4. Insert or Update branch\]](#bkmrk-user-to-remove)</span>.

#### 3. Delete branch

<details id="bkmrk-diagram-0"><summary>📊 Diagram</summary>

![image-1660653153427.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660653153427.png)</details>**3.1.** When the operation to perform is to delete a user, first of all, Soffid has to check if the user exists in the target system. To do this, Soffid executes the **property check** of the User object. This property executes the SQL command to check if the user exists or not.

<details id="bkmrk-by-clicking-on-the-u-0"><summary>📌 By clicking on the User exists? step,...</summary>

You can configure all the properties related to the user object for this step.

[![image-1660294676813.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660294676813.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660294676813.png)

</details>**3.1.1.** If the **user does not exist**, there are no actions to perform in the target system, so the process finishes <span style="background-color: #c2e0f4;">[\[10. End\]](#bkmrk-x.-end)</span>.

**3.1.2.** If the **user exists**, the flow continues executing the **pre-delete triggers** if there is anyone configured. More than one script can be configured. These scripts are executed just before the main action, user delete, and the result (true or false) determines if the main action will be performed or not.

**3.1.2.1. False**: if the result is false for one or more of these triggers, the process finishes <span style="background-color: #c2e0f4;">[\[10. End\]](#bkmrk-x.-end)</span>.

**3.1.2.2.True**: if the result is true for all of these triggers, Soffid continues to the next step.

<details id="bkmrk-by-clicking-on-pre-d"><summary>📌 By clicking on the Pre-delete triggers step,...</summary>

You can configure all the pre-delete triggers related to the user object for this step.

[![image-1660295438225.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660295438225.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660295438225.png)

</details>**3.1.3.** Soffid **removes the user**. To do that, Soffid executes the **property delete** of the User object.

<details id="bkmrk-by-clicking-on-the-r"><summary>📌 By clicking on the Remove user step,...</summary>

You can configure the properties related to the user object for this step.

[![image-1660297226512.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660297226512.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660297226512.png)

</details>**3.1.3.**  Then Soffid executes the **post-delete triggers** if any. These triggers can be used to perform a specific action just after performing the remove user operation on the target object.

<details id="bkmrk--0"><summary>📌 By clicking on the Post-delete triggers step,...</summary>

You can configure the post-delete triggers related to the user object for this step.

![image-1660228753412.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660228753412.png)

</details>**3.1.3.** Then the process finishes <span style="background-color: #c2e0f4;">[\[10. End\]](#bkmrk-x.-end)</span>.

#### 4. Insert or Update branch

**4.1.** When the operation to perform is to update a user, first of all, Soffid **generates the columns values**. That is, Soffid calculates the values of the columns from the original values of Soffid.

<details id="bkmrk-by-clicking-on-the-g"><summary>📌 By clicking on the generate column values step,...</summary>

You can configure the attributes related to the user object for this step.

![image-1660287889319.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660287889319.png)

</details>**4.2.**Then Soffid asks if the **user exists** in the target system to decide the action to execute, this action can be an update or an insert. Soffid executes the **property check** of the User object.

**4.2.1.** If the **user does not exist** in the target system, the process continues through <span style="background-color: #c2e0f4;">[\[5. Insert user branch\]](#bkmrk-5.-insert-user-branc)</span>.

**4.2.2.** If the **user exists** in the target system, the process continues through **<span style="background-color: #c2e0f4;">[\[](#bkmrk-6.-update-user%C2%A0branc)</span>**<span style="background-color: #c2e0f4;">[6. Update user branch\]](#bkmrk-6.-update-user%C2%A0branc)</span>.


<details id="bkmrk-by-clicking-on-the-u-1"><summary>📌 By clicking on the User exists? step,...</summary>

You can configure the properties related to the user object for this step.

![image-1660287995689.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660287995689.png)

</details>#### 5. Insert user branch

<details id="bkmrk-diagram-1"><summary>📊 Diagram</summary>

![image-1660653294372.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660653294372.png)</details>**5.1.** Soffid executes the **pre-insert triggers** if there is anyone configured. More than one script can be configured. These scripts are executed just before the main action, user create, and the result (true or false) determines if the main action will be performed or not.

**5.1.1. False**: if the response is false for one or more of these triggers, the process finishes [<span style="background-color: #c2e0f4;">\[10. End\]</span>](#bkmrk-x.-end) and the user is not created.

**5.1.2. True**: if the response is true for all of these triggers, Soffid continues to the next step.

**5.2.** Soffid **creates the** **user.** To do that, Soffid executes the **property insert** of the<span style="color: #e03e2d;"> </span>User<span style="color: #e03e2d;"> </span>object.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the"><summary>📌 By clicking on the Create user step,...</summary>

You can configure the properties related to the user object for this step.

![image-1660290443410.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660290443410.png)

</details>**5.3.** Then Soffid executes **post-insert triggers** if any. These triggers can be used to perform a specific action just after performing the create user operation on the target object.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-0"><summary>📌 By clicking on the Post-insert triggers step,...</summary>

You can configure the Post-insert triggers related to the user object for this step.

[![image-1660290613568.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660290613568.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660290613568.png)

</details>**5.4.** Then the process continues through [<span style="background-color: #c2e0f4;">\[7. Grants\]</span>](#bkmrk-5.-xxxx).

#### 6. Update user branch

<details id="bkmrk-diagram-2"><summary>📊 Diagram</summary>

![image-1660653234222.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660653234222.png)</details>**6.1.** Soffid **fetches the current values** of the user. Soffid executes the **property selectByAccountName** of the **User** object.

<span style="background-color: #eccafa;">&amp;&amp;TODO&amp;&amp; IMAGEN</span>

**6.2.** Then **compute delta changes**, if the property Synchronization method selected is Full Synchronization, then Soffid has to keep the columns values of the last update. If there was any change in the target system:

- There is no conflict, then Soffid only updates the values of the attributes that have changed in Soffid.
- There is conflict, Soffid values prevail over the target system values, so, Soffid updates all the attributes that have changed in Soffid.

<span style="background-color: #eccafa;">&amp;&amp;TODO&amp;&amp; IMAGEN</span>

**6.3.** And finally execute the **pre-update triggers** if there is anyone configured. More than one script can be configured. These scripts are executed just before the main action, user update, and the result (true or false) determines if the main action will be performed or not.

**6.3.1. False**: if the response is false for one or more of these triggers, the process finishes <span style="background-color: #c2e0f4;">[\[10. End\]](#bkmrk-x.-end)</span> and the user is not updated

**6.3.2. True**: if the response is true for all of these triggers, Soffid continues to the next step.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-1"><summary>📌 By clicking on the Pre-update triggers step,...</summary>

You can configure the Pre-update triggers related to the user object for this step.

[![image-1660305125794.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660305125794.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660305125794.png)

</details>**6.4.** Soffid **updates the user.** To do that, Soffid executes the **property update** of the **or Use**r object.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-2"><summary>📌 By clicking on the update user step,...</summary>

 You can configure the properties related to the user object for this step.

[![image-1660305271649.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660305271649.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660305271649.png)

</details>**6.5.** Then Soffid executes the **post-update triggers** if any. These triggers can be used to perform a specific action just after performing the update user operation on the target object.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-3"><summary>📌 By clicking on the Post-update triggers step,...</summary>

You can configure the Post-update triggers related to the user object for this step.

[![image-1660305556302.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660305556302.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660305556302.png)

</details>**6.6.** Then the process continues through [<span style="background-color: #c2e0f4;">\[7. Grants\]</span>](#bkmrk-5.-xxxx).

#### 7. Grants

At this point, soffid runs the actions relative to the grants

**7.1.** Once the process arrives at this step, Soffid **generates account column values**. That is, Soffid creates a dummy object with only the account name, this object will be used later.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-4"><summary>📌 By clicking on the generates account columns values step,...</summary>

You can configure the attribute mappings related to the grant object for this step.

[![image-1660297529635.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660297529635.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660297529635.png)

</details>**7.2.** Then, Soffid **fetches the current grants** for the user. Soffid executes the **property selectByAccount** of the grant<span style="color: #e03e2d;"> </span>object with the values of the previous step

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-5"><summary>📌 By clicking on the fetch current grants step,...</summary>

 You can configure the properties related to the grant object for this step.

[![image-1660298601931.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660298601931.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660298601931.png)

</details>**7.3.** Finally, Soffid **parses grant rows,** that is Soffid makes the mappings defined

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-6"><summary>📌 By clicking on the parse grant rows step,...</summary>

 You can configure the attribute mappings related to the grant object for this step.

[![image-1660298660328.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660298660328.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660298660328.png)

</details>**7.3.** Then the process continues through <span style="background-color: #c2e0f4;">[\[8. Grant to add\]](#bkmrk-6.%C2%A0grant-to-add)</span>.

#### 8**.** Grant to add

This is a loop while there are grants to add. This grants list comes from the previous step <span style="background-color: #c2e0f4;">[\[7. Grants\]](#bkmrk-5.-xxxx)</span>.

<details id="bkmrk-diagram-3"><summary>📊 Diagram</summary>

![image-1660657837165.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660657837165.png)</details>**8.1.** If there are **No** grants to add, the process goes to <span style="background-color: #c2e0f4;">[\[9. Grant to Remove\]](#bkmrk-9.-grant-to-remove)</span>.

**8.2. Yes,** there are grants to add:

**8.2.1.** Soffid **generates grant column values** and Soffid checks if the grant exists in the target system, Soffid executes the **property check** of the grant object.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-7"><summary>📌 By clicking on the generate grant column values step,...</summary>

 You can configure the attribute mappings related to the grant object for this step.

[![image-1660306333224.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660306333224.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660306333224.png)

</details>**8.2.2.** Soffid executes the **pre-insert triggers** if there is anyone configured. More than one script can be configured. These scripts are executed just before the main action, a grant create, and the result (true or false) determines if the main action will be performed or not.

**8.2.2.1. False**: if the response is false for one or more of these triggers, the process goes to [<span style="background-color: #c2e0f4;">\[8. Grant to add\]</span>](#bkmrk-6.%C2%A0grant-to-add) and the grant is not created.

**8.2.2.2. True**: if the response is true for all of these triggers, Soffid continues to the next step.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-8"><summary>📌 By clicking on the Pre-insert triggers step,...</summary>

 You can configure the Pre-insert triggers related to the grant object for this step.

[![image-1660651106043.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660651106043.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660651106043.png)

</details>**8.2.3.** If the result of the triggers is true, then Soffid **creates the grant.** To do that, Soffid executes the **property insert** of the grant<span style="color: #e03e2d;"> </span>object.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-9"><summary>📌 By clicking on the create grant step,...</summary>

 You can configure the properties related to the grant object for this step.

[![image-1660306637374.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660306637374.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660306637374.png)

</details>**8.2.4.** Then Soffid executes the **post-insert triggers** if any. These triggers can be used to perform a specific action just after performing the create grant operation on the target object.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-10"><summary>📌 By clicking on the Post-insert triggers column values step,...</summary>

 You can configure the Post-Update related to the grant object for this step.

[![image-1660651171773.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660651171773.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660651171773.png)

</details>**8.2.5.** Then the process continues through  [<span style="background-color: #c2e0f4;">\[8. Grant to add\]</span>](#bkmrk-6.%C2%A0grant-to-add).

#### 9. Grant to remove

<details id="bkmrk-diagram-4"><summary>📊 Diagram</summary>

![image-1660657874513.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660657874513.png)</details>This is a loop while there are grants to remove. This grants list comes from the previous step \[7. Grants\].

**9.1 No**: If there are No grants to add, the process goes to <span style="background-color: #c2e0f4;">[\[10. End\]](#bkmrk-x.-end)</span>.

**9.2. Yes,**  there are grants to remove:


**9.2.1.** Soffid executes the **pre-delete triggers** if there is anyone configured. More than one script can be configured. These scripts are executed just before the main action, a grant delete, and the result (true or false) determines if the main action will be performed or not.

**9.2.1.1. False**: if the response is false for one or more of these triggers, the process finishes <span style="background-color: #c2e0f4;">[\[10. End\]](#bkmrk-x.-end)</span> and the grant is not deleted.

**9.2.1.2. True**: if the response is true for all of these triggers, Soffid continues to the next step.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-11"><summary>📌 By clicking on the pre-delete trigger step,...</summary>

 You can configure the Pre-delete triggers related to the grant object for this step.

[![image-1660651495130.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660651495130.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660651495130.png)

</details>**9.2.2. If the result of the triggers is true, then Soffid **deletes the grant.** To do that, Soffid executes the **property delete** of the grant<span style="color: #e03e2d;"> </span>object. This operation can return a true or false result.

**9.2.2.1. False:** the delete action could not be performed and the process check for another grant <span style="background-color: #c2e0f4;">[\[9. Grant to remove\]](#bkmrk-9.-grant-to-remove)</span>.

**9.2.2.2. True:** the delete action could be performed properly. Soffid continues to the next step.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-12"><summary>📌 By clicking on the delete grant step,...</summary>

 You can configure the properties related to the grant object for this step.

[![image-1660651418301.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660651418301.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660651418301.png)

</details>**9.2.3.** Then Soffid executes the **post-delete triggers** if any. These triggers can be used to perform a specific action just after performing the delete grant operation on the target object.

<details id="bkmrk-%F0%9F%93%8C-by-clicking-on-the-13"><summary>📌 By clicking on the post-delete trigger step,...</summary>

 You can configure the Post-delete triggers related to the grant object for this step.

[![image-1660661955749.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660661955749.png)](https://bookstack.soffid.com/uploads/images/gallery/2022-08/image-1660661955749.png)

</details>**9.2.4.** Then the process continues through <span style="background-color: #c2e0f4;">[\[9. Grant to remove\]](#bkmrk--10)</span>.

#### 10. End

The process finishes and the log is displayed, and you can download it by clicking the *Download* button.

<details id="bkmrk-%F0%9F%93%91-log-detail"><summary>📑 Log detail</summary>

![image-1660662018857.png](https://bookstack.soffid.com/uploads/images/gallery/2022-08/scaled-1680-/image-1660662018857.png)</details>