SBX - Search With Button

SBX - Forum Post Title

How Can i do bulk Sharing using a Plugin

Microsoft Dynamics CRM Forum

Abish Asharaf asked a question on 8 Apr 2011 8:16 AM
My Badges

Question Status

Suggested Answer

Hi, Can we do bulk sharing using a plug-in. I have 1000's of records to be shared amoung 50 different peoples. I can't use security roles due to the business process, but this will be a list of users who need visibility on these records? Does sharing records in dynamics crm cause any performance impact or not considered as a best practices.

Reply
Alex Fagundes responded on 8 Apr 2011 3:49 PM
My Badges
Suggested Answer

HI Abish,

You should be able to do so with a plugin or workflow extension.  Here's a project that will get you 90% there from code plex:

crm40sharestep.codeplex.com

Reply
Abish Asharaf responded on 11 Apr 2011 2:21 AM
My Badges

Alex,

       Thanks for the reply, but this code is still using a foreach statement for sharing the record one by one and sending separate request to CRM. In my case I have around 1000's of records which has to be shared with approximately 50 people each and if we use this approach, I might be sending ( 1000 * 50 ) separate request to CRM Service which isn’t great.

I think probably I might change my design approach if possible.

Kind Regards

Abish

Reply
MёLvìN Fong responded on 17 May 2017 12:17 AM
My Badges
Suggested Answer

You can minimize the resource constraint by using a bulk request.

For example, putting 250 share request into one bulk request and use the SDK to execute the bulk request. This will reduce a lot of the network traffic.

i.e.

for (i=0; i<5000; i+=250)

{

 bulkrequest = new bulk request();

 foreach (250)

 {

   bulkrequest.add(new share request())

 }

 service.execute(bulkrequest)

}

Reply
Ryno Engelbrecht responded on 17 May 2017 2:11 AM

Hi Abish,

Is this requirement for Online or onPrem?

Will the 50 Users be based on a certain criteria or will it always be the same users?

If so maybe create a team and have them all assigned to the team then using a asyn plugin with a parallel foreach assign the records to the team.

Reply
Flydancer responded on 6 Sep 2018 7:47 AM
My Badges
Suggested Answer

Just use ExecuteMultipleRequest for bulk insertion: Link

Reply
RandaFlores responded on 17 May 2019 12:12 PM

What are you going to share?

Reply
Alex Fagundes responded on 8 Apr 2011 3:49 PM
My Badges
Suggested Answer

HI Abish,

You should be able to do so with a plugin or workflow extension.  Here's a project that will get you 90% there from code plex:

crm40sharestep.codeplex.com

Reply
MёLvìN Fong responded on 17 May 2017 12:17 AM
My Badges
Suggested Answer

You can minimize the resource constraint by using a bulk request.

For example, putting 250 share request into one bulk request and use the SDK to execute the bulk request. This will reduce a lot of the network traffic.

i.e.

for (i=0; i<5000; i+=250)

{

 bulkrequest = new bulk request();

 foreach (250)

 {

   bulkrequest.add(new share request())

 }

 service.execute(bulkrequest)

}

Reply
Flydancer responded on 6 Sep 2018 7:47 AM
My Badges
Suggested Answer

Just use ExecuteMultipleRequest for bulk insertion: Link

Reply

SBX - Two Col Forum

SBX - Migrated JS