RE: How to use AfterPrimaryImport function present in Package Deployer
Hi Mihir,
The PackageTemplate
class that contains the AfterPrimaryImport
method has a property named CrmSvc
which is of type CrmServiceClient
and implements IOrganizationService
.
You can use this service to make whichever calls you need to make against your instance.
One possible implementation follows:
In your PackageTemplate class:
public override bool AfterPrimaryImport()
{
return new PostDeployCommands(this).Execute();
}
Then in your PostDeployCommands class:
public PostDeployCommands(PackageTemplate packageTemplate)
{
this._traceLogger = packageTemplate.PackageLog;
this._organizationService = packageTemplate.CrmSvc;
}
public bool Execute(){
// Do whatever you need to do here.
// You now have access to logging and the organization service.
...
return isSuccessful;
}
Hope this helps! :)