# Create an access request from a custom workflow

**URL:** <https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059>\
**Category:** IIQ Discussion and Questions\
**Tags:** access-requests, workflows, rules, identityiq\
**Created:** [June 13, 2024, 5:09pm UTC](https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059 "2024-06-13T17:09:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ninfante\_solidigm](https://avatars.discourse-cdn.com/v4/letter/n/45deac/32.png) [@ninfante\_solidigm](https://developer.sailpoint.com/discuss/u/ninfante_solidigm)\
**Post date:** [June 13, 2024, 5:09pm UTC](https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059/1 "2024-06-13T17:09:21Z")

</div>

### Which IIQ version are you inquiring about?

Version 8.3

### Share all details related to your problem, including any error messages you may have received.

Hi all,

Hope everything’s well.  
I apologize to open this post here, I couldn’t find a way to get this working.  
We have a custom workflow that’s going to be called from postman. This custom workflow will be performing few operations, and one of them should be creating an access request for a user.  
We’d like to recreate the same proyect/plan where a user goes and manually requests an access for a user in Manage User Access, selecting the desired bundle, creating the account in this source.  
I’ve read that I should be calling the LCM Provisioning workflow from my custom workflow for this case, and while I’m trying to fix the errors that I’m receiving, wanted to ask if this is the correct path to achieve this.

Have you created an access request from a rule or custom workflow? If so, what steps did you follow?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![pravin\_ranjan](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/pravin_ranjan/32/6771_2.png) [@pravin\_ranjan](https://developer.sailpoint.com/discuss/u/pravin_ranjan)\
**Post date:** [June 13, 2024, 6:38pm UTC](https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059/2 "2024-06-13T18:38:59Z")

</div>

You are in correct path, but in my case i created custom WF that will also do same. At my end the requirement is bit complex

See some thread here

[Triggering access requests via joiner workflow - IdentityIQ (IIQ) / IIQ Discussion and Questions - SailPoint Developer Community](https://developer.sailpoint.com/discuss/t/triggering-access-requests-via-joiner-workflow/55799)

[Create Custom Identity Request by Custom Workflow to see in Track My Request - IdentityIQ (IIQ) / IIQ Show and Tell - SailPoint Developer Community](https://developer.sailpoint.com/discuss/t/create-custom-identity-request-by-custom-workflow-to-see-in-track-my-request/55931/3)

---

<div class="post-metadata">

**Author:** ![vishal\_kejriwal1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/vishal_kejriwal1/32/10904_2.png) [@vishal\_kejriwal1](https://developer.sailpoint.com/discuss/u/vishal_kejriwal1)\
**Post date:** [June 13, 2024, 6:44pm UTC](https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059/3 "2024-06-13T18:44:29Z")

</div>

Check below sample code

```auto
QueryOptions qo = new QueryOptions();
Filter filter = Filter.eq("attributeName", "value");
qo.add(filter);

Iterator<Identity> it = context.search(Identity.class, qo);
if (it != null) {
	while (it.hasNext()) {
		Identity id = it.next();
		HashMap launchArgsMap = new HashMap();
		ProvisioningPlan plan = new ProvisioningPlan();

		// add your logic to create plan

		if (plan != null && !plan.isEmpty()) {

			launchArgsMap.put("identityName", id.getName());
			launchArgsMap.put("plan", plan);
			launchArgsMap.put("approvalScheme", "none");
			WorkflowLaunch wflaunch = new WorkflowLaunch();
			Workflow wf = null;

			try {
				wf = (Workflow) context.getObjectByName(Workflow.class, "LCM Provisioning");
			} catch (GeneralException e) {
				log.error(e);
			}

			if (wf != null) {

				wflaunch.setWorkflowName(wf.getName());
				wflaunch.setWorkflowRef(wf.getName());
				wflaunch.setVariables(launchArgsMap);

				Workflower workflower = new Workflower(context);
				try {
					WorkflowLaunch launch = workflower.launch(wflaunch);
					log.debug("workflow launched sucessfully " + launch);
				} catch (GeneralException eGeneralException) {
					log.error(eGeneralException);
				}

			}
		}

	}	

}

```

---

<div class="post-metadata">

**Author:** ![ninfante\_solidigm](https://avatars.discourse-cdn.com/v4/letter/n/45deac/32.png) [@ninfante\_solidigm](https://developer.sailpoint.com/discuss/u/ninfante_solidigm)\
**Post date:** [June 13, 2024, 9:32pm UTC](https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059/4 "2024-06-13T21:32:57Z")

</div>

Thanks for your reply! I’ll take a look at this.  
The issue we’re having is that we can’t really hardcode a provisioningPlan since it will change depending on the source. If it were for only one source, it would be great, but since it can be requesting an account in Active Directory, GitHub, etc., I don’t think hardcoding the plan would be effective  
If there’s a way to execute the provisioning form to grab all the data that the source needs from the intended identity, it would be fantastic

---

<div class="post-metadata">

**Author:** ![pravin\_ranjan](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/pravin_ranjan/32/6771_2.png) [@pravin\_ranjan](https://developer.sailpoint.com/discuss/u/pravin_ranjan)\
**Post date:** [June 13, 2024, 9:41pm UTC](https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059/5 "2024-06-13T21:41:21Z")

</div>

@ninfante_solidigm You can try with role assignment and either use role based provisioning plan or application one. I mean when you will try to assign role then it will call app’s create provisioning policy and you can put your logic in app provisioning form.

---

<div class="post-metadata">

**Author:** ![vishal\_kejriwal1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/vishal_kejriwal1/32/10904_2.png) [@vishal\_kejriwal1](https://developer.sailpoint.com/discuss/u/vishal_kejriwal1)\
**Post date:** [June 13, 2024, 9:46pm UTC](https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059/6 "2024-06-13T21:46:58Z")

</div>

You can write your logic and create plan accordingly . I think if you give a clear use case what exactly you are trying to do , then it will be easy to understand .

---

<div class="post-metadata">

**Author:** ![ninfante\_solidigm](https://avatars.discourse-cdn.com/v4/letter/n/45deac/32.png) [@ninfante\_solidigm](https://developer.sailpoint.com/discuss/u/ninfante_solidigm)\
**Post date:** [June 13, 2024, 9:57pm UTC](https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059/7 "2024-06-13T21:57:35Z")

</div>

The use case would be the following:

1. I execute the API call in Postman to execute my custom workflow.
2. I’m sending what operation I want to perform in SailPoint, which in this case will be an account creation.  
2.1 From Postman, I’m sending the bundle’s name, the source’s name and the identity that will be used to perform the account creation.
3. This custom workflow performs the creation of the account in the desired source, either calling another workflow such as LCM Provisioning, or handling the request by itself.

My understanding is that the plan, specifically the attributeRequests would change depending on the provisioning form of the source. Some needs specific attributes, others need other attributes. Please correct me if I’m wrong but that’s my understanding.  
Active directory, to say a source, needs ‘n’ attributes from the identity, but if I want to create an account in SAP, surely it’ll need less attributes from the identity.  
Hope this help! Also really thanks again for your help here

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [August 12, 2024, 9:58pm UTC](https://developer.sailpoint.com/discuss/t/create-an-access-request-from-a-custom-workflow/66059/8 "2024-08-12T21:58:25Z")

</div>

Closed on August 12, 2024, 9:58pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
