0 votes

I am trying to use a script to set a users AccountExpires attribute. However, I want there to be an approval sent and I am misunderstanding how the to script the approval. Here is what I have but does not send the operation to an approval. Try{ Set-AdmUser -Identity $SAM -AccountExpirationDate $TermDate -AdaxesService localhost $approvers = @( "CN=spedifiedUserDN") $managerOfRequestorIsApprover = $False $Context.SubmitForApproval($approvers, $managerOfRequestorIsApprover, $false, $false, $false) }

by (1.0k points)

1 Answer

+1 vote
by (14.5k points)

Hello,

The thing is the SubmitForApproval method submits an approval request for the operation that caused the script execution, not the operations performed in the script where the method is called. For example, if the script is executed in a custom command, the execution of the command will be submitted for approval. The approach from the script you provided will not work. The thing is in this case, the Set-AdmUser cmdlet will be executed first (which will actually update the user) and only then the execution of the operation will be sent for approval. For more details about submitting for approval using a PowerShell script, have a look at the corresponding section of the following SDK article: https://www.adaxes.com/sdk/ServerSideScripting/#submitting-for-approval. To achieve the required, there is no need to submit for approval in the script itself. You can simply enable the Get approval for this action option in the configuration of the Run a program or PowerShell script action. image.png If this is not what you meant, please, provide us with all the possible details regarding the required behavior with screenshots and live examples. You can post the screenshots here or send them to us at support@adaxes.com.

In a script, can we trigger a custom command?

Related questions

0 votes
1 answer

I am trying to create a new user, whose emailaddress is directly associated with the company, but it is simply not updating. I created a business rule to be exceuted ... should be accordingly. But after the user is created it says no operation executed. Thanks

asked Mar 9, 2022 by Kamini (80 points)
0 votes
1 answer

Hi all, Am trying to convert a mailbox from a user box to a shared box in O365. Have been for the past few weeks even. The ... account the method points at - http://www.adaxes.com/sdk/?ExecuteScriptContextClass.html#executescriptcontext_getoffice365credential

asked Feb 24, 2020 by TheLexicon (200 points)
0 votes
1 answer

Trying to set the primary proxy when doing a name change on an email address.

asked Jul 13, 2023 by mightycabal (1.0k points)
0 votes
1 answer

The rule runs but since the first name and last name are passed as parameters, I only get the sequential # as a userID without the initials.

asked Oct 24 by curtisa (290 points)
3,588 questions
3,277 answers
8,303 comments
548,090 users