Using “LookupWorkflowContextProperty“, we can retrieve Current Site URL.
LookupWorkflowContextProperty retrieves a property from the workflow instance.
LookupWorkflowContextProperty which return following properties.
- Associator: SharePoint app pool account when you first created the web application. [SHAREPOINT\system]
- Initiator: Get the name of the workflow Initiator, It will return user name who initiate the workflow
- Association Name: “UserInfoWorkflow – ItemAdded” It will return the Workflow start options [Start workflow Manually Mm Created and Updated].
- Instance ID: “WorkflowInstanceName” Workflow Instance id which can be seen in the Workflow Status URL [76bae674-7888-4f99-b812-9048bf8e84c9].
- Current Site URL: It will return the Current Site URL.
- Current Item URL: It will return the Current Item URL.
- List Name: It will return List name which is associated with the workflow.
- List Id : It will return List Guid [ {2188AB02-E5CE-46C5-B580-C1279CE2CA62} ] which is associated with the workflow.
I used “LookupWorkflowContextProperty” activity in my workflow to get the value of the Current Site URL.
For Debugging purpose I am printing Current Site URL value in WriteToHistry activity property by using the varCurrentSiteURL local variable.
The workflow is associated with UserInfoList.
Here is the desired output of the Current Site URL which I printed using WriteToHistry.
Hope you find it helpful. If you liked this article, then please share and comment.