My new blog present here.

Featured Post

Insights into Sitecore Search: A Definitive Introduction

A key component of digital experience management is effective information retrieval. A simplified approach is required for websites, applications, and platforms containing a lot of material so that consumers can easily get the data they require. This need is met by Sitecore, a well-known name in the field of digital experience platforms (DXPs), which provides powerful and comprehensive search functionality. We will travel into the realm of Sitecore Search in this article, learning about its capabilities, architecture , and the enormous value it offers both developers and end users. Introduction to Sitecore Search    A headless content discovery platform powered by AI , Sitecore Search enables you to build predictive and custom search experiences across various content sources. To extract and index you

.NET forms integration within the Sharepoint workflow

Overview:

This article explains you how to get data into the Workflow from “Custom User Forms.” It turns out that SharePoint allows developers to prompt the administrators and users for information at several stages along the workflow:.

When is the workflow done connected to a SharePoint List or Document Library. This is by building and attaching aSharePoint Association Form which allows the Administrator, or a user, who connects the workflow to a SharePoint List, to set “default” values and behavior for the workflow.

Just workflow is before the prompt the user started, which gives the developer an opportunity to for information that might be needed at the start of the workflow and/or give the user an opportunity to override the default values defined via the Association Form. This is done by providing the user with a custom Instantiation/Initiation form

At running anytime during a workflow, by providing a Modification form

By assigning users Tasks (think” Outlook Tasks”), using Task-Edit forms

This workshop will focus on the Instantiation or Initiation form. The SharePoint documentation and API refers to this form by both names, but for this workshop I will refer to it as the Instantiation form. Here we are creating the initiation page

Here we are creating the custom ASPX form as the initiation page, when user invoke the instance of the workflow then first he will see that form. After submission of this form workflow will be triggered

1.How we can refer to the back end assembly/dll in the ASPX. Inherits from the NameSpace

+ BackEnd Code

<%@ Page Language="C#" EnableSessionState="True" EnableViewState="true" ValidateRequest="false" Inherits="AmitKumar.F.V.Workflows..

PublishToLibrary.Instantiation" %>

2. Where we create our design.

<asp:panel id="pnlContent" runat="server" visible="true">

<wssuc:InputFormSection Title="Product Line" Description="" runat="server">

<template_inputformcontrols>

<wssuc:InputFormControl runat="server" LabelText="" >

<Template_Control>

<%--This is your form area, here you can create your form design--%>

</div>

</Template_Control>

</wssuc:InputFormControl>

</template_inputformcontrols>

</wssuc:InputFormSection>

3. How we get the workflow properties in the ASPX form.

<input type="hidden" name="WorkflowDefinition" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["WorkflowDefinition"]),Response.Output); %>'/>

<input type="hidden" name="WorkflowName" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["WorkflowName"]),Response.Output); %>'/>

<input type="hidden" name="AddToStatusMenu" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["AddToStatusMenu"]),Response.Output); %>'/>

<input type="hidden" name="AllowManual" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["AllowManual"]),Response.Output); %>'/>

<input type="hidden" name="RoleSelect" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["RoleSelect"]),Response.Output); %>'/>

<input type="hidden" name="GuidAssoc" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["GuidAssoc"]),Response.Output); %>'/>

<input type="hidden" name="SetDefault" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["SetDefault"]),Response.Output); %>'/>

<input type="hidden" name="HistoryList" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["HistoryList"]),Response.Output); %>'/>

<input type="hidden" name="TaskList" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["TaskList"]),Response.Output); %>'/>

<input type="hidden" name="UpdateLists" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["UpdateLists"]),Response.Output); %>'/>

<input type="hidden" name="AutoStartCreate" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["AutoStartCreate"]),Response.Output); %>'/>

<input type="hidden" name="AutoStartChange" value='<% SPHttpUtility.NoEncode(SPHttpUtility.HtmlEncode(Request.Form["AutoStartChange"]),Response.Output); %>'/>

<SharePoint:FormDigest ID="FormDigest1" runat="server" />

4. Inherit class.

public class Instantiation : LayoutsPageBase

5. Set Master page at the run time.

protected override void OnPreInit(EventArgs e)

{

base.OnPreInit(e);

this.objWeb = SPContext.Current.Web;

// Set Master page at the run time

this.MasterPageFile = objWeb.MasterUrl;

}

6. Check context on page load.

if (base.Context != null)

{

if (SPControl.GetContextWeb(base.Context) != null)

{

}

}

7. Custom Submit button to invoke the workflow, and pass initiation data through serialization.

public void cmdSubmit_OnClick(object sender, EventArgs e)

{

string RedirectUrl = this.List.DefaultViewUrl;

SPLongOperation op = new SPLongOperation(this);

try

{

op.Begin();

try

{

this.objWeb.Site.WorkflowManager.StartWorkflow(this.ListItem, this.Association, this.InitiationDataToXml(), true);

}

catch (UnauthorizedAccessException ex)

{

SPUtility.HandleAccessDenied(ex);

}

catch (Exception ex)

{

SPUtility.TransferToErrorPage(ex.Message);

}

op.End(RedirectUrl, SPRedirectFlags.Static, this.Context, null);

}

finally

{

if (op != null)

op.Dispose();

}

}

8. Update workflow.xml file to invoke the initiation page.

<Workflow

Name="V Publish To Library"

Description="This workflow publishes the documents to the Varian ELibrary."

Id="0F5CE373-78A1-41DC-B70C-704497D51239"

CodeBesideClass="AmitKumar.F.V.Workflows.VPublishToLibrary.SubmitToLibrary"

CodeBesideAssembly="AmitKumar.F.V.VPublishToLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b0d0369bcaffb497"

InstantiationUrl="_layouts/AmitKumar/VWorkflows/Instantiation.aspx">

<Categories/>

</Workflow>


Comments

Popular posts from this blog

Sitecore GraphQL Queries

Sitecore Experience Edge GraphQL Queries

Configuring Sitecore Next.js Headless SXA Multisite App in a Sitecore Container