Share Point auto generate column value

Step-1:- Go the share point and create the list.

Share Point

Step-2:-

    So let us create the flow.

    Go to https://flow.microsoft.com and sign in with your Office 365 credentials.

    Next click on Create from the navigation and then select Automated flow like below:

Step-3:-

The Flow name and in the choose your flow’s trigger select When an item is created like below:

Step-3:-

Next, select the SharePoint site address from the Site Address dropdown like below. Once you select the SharePoint site, it will auto-populate the lists in the List Name dropdown. Select your List.

Step-4:-

      Next, click on + Next step. And then search for variable in choose action and add a Initialize variable select Type as String and in the value click on “Add dynamic content”.

concat(‘Sale List-‘,triggerBody()?[‘Job Tittle’]?[‘value’],’-‘,triggerBody()?[‘ID’])

Step-5:-

Now, we need to update the list column value with this value coming in the variable. For this click on + New Step and then you can choose Update item flow action.

Step-6:-

     Save the flow and by this step, we created our flow successfully, that will auto generate SharePoint list column value. save and test it.

Step-7:-

        Note: Don’t enter anything for the JobID column, this column value will be updated by the Microsoft flow. You can also remove the list column from the New form or edit form in the SharePoint list.

For any Help or Queries Contact us on info@crmonce.com or +918096556344

 

The CreatePass  OnWorkerStatusApproved plugin is a custom plugin developed for Microsoft Dynamics 365 (CRM). It triggers when the status of a worker entity (crm_worker) is updated. Specifically, it runs when the worker’s status is changed to “Approved”. When triggered, the plugin automatically creates a related “Pass” entity (crm_pass) with details pulled from the worker record.

using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;

public class CreatePassOnWorkerStatusApproved : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
tracingService.Trace(“CreatePassOnWorkerStatusApproved Plugin: Execution started.”);

try
{
if (context.MessageName != “Update”)
return;

tracingService.Trace(“Message is Update.”);

IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

Entity entity = (Entity)context.InputParameters[“Target”];

if (entity.LogicalName == “crm_worker” && entity.Contains(“crm_workerstatus”))
{
tracingService.Trace(“Entity is crm_worker and contains workstatus.”);

Entity workerEntity = service.Retrieve(“crm_worker”, entity.Id, new ColumnSet(true));
tracingService.Trace(“Worker entity retrieved. Worker Id: {0}”, workerEntity.Id);

if (workerEntity.GetAttributeValue<OptionSetValue>(“crm_workerstatus”).Value == 770060001)
{
tracingService.Trace(“Worker status is Approved.”);

Entity passEntity = new Entity(“crm_pass”);

passEntity[“crm_name”] = workerEntity.GetAttributeValue<string>(“crm_passnumber”);
passEntity[“crm_passexpiredate”] = workerEntity.GetAttributeValue<DateTime>(“crm_passexpiredate”);
passEntity[“crm_passissuedate”] = workerEntity.GetAttributeValue<DateTime>(“crm_passissuedate”);
passEntity[“crm_department”] = workerEntity.GetAttributeValue<string>(“crm_department”);
passEntity[“crm_designation”] = workerEntity.GetAttributeValue<string>(“crm_designation”);

passEntity[“crm_worker”] = new EntityReference(“crm_worker”, workerEntity.Id);
tracingService.Trace(“crm_worker lookup set.”);

passEntity[“crm_passstatus”] = workerEntity.GetAttributeValue<OptionSetValue>(“crm_passstatus”);
tracingService.Trace(“crm_passstatus set.”);

passEntity[“crm_passtype”] = workerEntity.GetAttributeValue<OptionSetValue>(“crm_passtype”);
tracingService.Trace(“crm_passtype set.”);

if (workerEntity.Contains(“crm_companyname”))
{
EntityReference accountRef = workerEntity.GetAttributeValue<EntityReference>(“crm_companyname”);
Entity accountEntity = service.Retrieve(“crm_company”, accountRef.Id, new ColumnSet(“crm_name”));
passEntity[“crm_companyname”] = accountEntity.GetAttributeValue<string>(“crm_name”);
tracingService.Trace(“Account name set in crm_company field.”);
}

service.Create(passEntity);
tracingService.Trace(“Pass record created successfully.”);
}

}

}
catch (Exception ex)
{
tracingService.Trace(“CreatePassOnWorkerStatusApproved Plugin: {0}”, ex.ToString());
throw;
}

}
}