SBX - Search With Button

SBX - Forum Post Title

Plugin through error "An error has occurred. The selected action was not completed for one or more records."

Microsoft Dynamics CRM Forum

Prasanth M asked a question on 22 May 2019 10:36 AM

Question Status

Suggested Answer

In bulk edit on Contact i wrote a plugin, when ever i tried to do the bulk edit it through error like this "An error has occurred. The selected action was not completed for one or more records". If i edited single record means then it not throwing me error.

Plugin steps registered on : Update

Can anyone please help me to over come this issue.

Reply
Shidin Haridas responded on 22 May 2019 10:38 AM
My Badges
Suggested Answer

Prasanth -

you can have a plugin for update operation.

AFAIK, there is no plugin for 'bulk edit'.

Now, what is the edit you are trying to do? Are you trying to edit inactive records as well?

Reply
Prasanth M responded on 22 May 2019 10:55 AM

I am trying to edit one specific field in the contact entity, yes they will edit both active and inactive records.Also i noted in audit history bulk edit operation event occurring as Update only.

Reply
Shidin Haridas responded on 22 May 2019 11:06 AM
My Badges
Suggested Answer

Try doing the operation ONLY for active records.

Inactive records CANNOT be updated.

Reply
Prasanth M responded on 22 May 2019 11:28 AM

yes currently i  am trying with active records only. I tried this below code this simple code also troughs error. but while i tired the single update the same code works fine plugin triggered. 

public class UpdateEnrollmentPlugin : PluginBase
{

protected override void OnExecute(IServiceProvider serviceProvider)

       {

           var context = GetContext(serviceProvider);

           var service = GetOrganizationService(serviceProvider);

           Entity entity = (Entity)context.InputParameters["Target"] as Entity;

           if (context.MessageName == "Update")

           {
              throw new exception(); //exception not hitting 
             //Logic here

           }

       }

}
 

Reply
Prasanth M responded on 19 Jun 2019 8:22 AM
Suggested Answer

We can write a plugin code for Bulk update/Edit, it works for me. I did mistake in the execution order, one or more plugin get clash on execution order means we will get this type of error "An error has occurred. The selected action was not completed for one or more records.".

Reply
Dynamics365 Rocker responded on 19 Jun 2019 9:39 AM
My Badges
Suggested Answer

Please check that all records in that view are active before clicking on bulk edit.

Reply
mardukes responded on 19 Jun 2019 9:45 AM
My Badges

Threw

Reply
Shidin Haridas responded on 22 May 2019 10:38 AM
My Badges
Suggested Answer

Prasanth -

you can have a plugin for update operation.

AFAIK, there is no plugin for 'bulk edit'.

Now, what is the edit you are trying to do? Are you trying to edit inactive records as well?

Reply
Shidin Haridas responded on 22 May 2019 11:06 AM
My Badges
Suggested Answer

Try doing the operation ONLY for active records.

Inactive records CANNOT be updated.

Reply
Prasanth M responded on 19 Jun 2019 8:22 AM
Suggested Answer

We can write a plugin code for Bulk update/Edit, it works for me. I did mistake in the execution order, one or more plugin get clash on execution order means we will get this type of error "An error has occurred. The selected action was not completed for one or more records.".

Reply
Dynamics365 Rocker responded on 19 Jun 2019 9:39 AM
My Badges
Suggested Answer

Please check that all records in that view are active before clicking on bulk edit.

Reply

SBX - Two Col Forum

SBX - Migrated JS