mshanemc / roundRobinProcessBuilder

27 stars 10 forks source link

40 Char Limit #11

Open stargaterx opened 4 years ago

stargaterx commented 4 years ago

Good evening

Trying to test and deploy APEX. I was able to change classes and get successful deployment with what I thought was correct changes to customSettingNameLimitLength but that didn't work. I'm using a custom object in case that matters.

What other changes to classes do I need to do to increase to 80 characters?

mshanemc commented 4 years ago

That is a hard limit on custom settings you can vote on fixing here: https://success.salesforce.com/ideaView?id=08730000000keQlAAI

I meant to fix that with the code here: https://github.com/mshanemc/roundRobinProcessBuilder/blob/96458ef005b148f520fee6c254c3695c1475f5c7/force-app/main/default/classes/roundRobinAssigner.cls#L105

Can you try, maybe in a sandbox/scratch org, installing the code from this repo to see if it works? It's possible the appexchange doesn't have the latest version with the fix.

bernadettebuck commented 4 years ago

Hi Shane,

I tested this in my org and ran into issues. I believe nameshortener is failing when the lengths of the three strings is too different from each other. I added this test to your nameshortener tests and it fails: System.assertEquals(40, roundRobinAssigner.nameShortener('1234467443456789012345', '12345', '1234567893498374348764387638763401234').length());

The reason I was testing this particularly is that our object name is crazy long. Here is the actual error we get when trying to save a record that is subject to the assigner (using the version currently in master):

We can't save this record because the “ARM Complete and App Review Initial Review Created” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: CANNOT_EXECUTE_FLOW_TRIGGER: We can't save this record because the “App Review - Manage Subsequent Reviews” process failed. Give your Salesforce admin these details. An Apex error occurred: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Custom Setting Name too long: TargetX_Reader__Application_Review-Owne-: Name: [Name] Error ID: 482361675-287467 (-1873928091). You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 482361675-287470 (1171165099)

with version 1.0 (off the appexchange), the error reads as follows (so you can see the entire string pre-shortening):

We can't save this record because the “ARM Complete and App Review Initial Review Created” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: CANNOT_EXECUTE_FLOW_TRIGGER: We can't save this record because the “App Review - Manage Subsequent Reviews” process failed. Give your Salesforce admin these details. An Apex error occurred: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Custom Setting Name too long: TargetX_Reader__Application_Review__c-OwnerId-ALB App Review Group: Name: [Name] Error ID: 482361675-283604 (-1873928091). You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 482361675-283613 (1171165099)

Happy to test if you have a thought as to how to fix. I am also willing to attempt a fix, if you don't have time, and submit a pull request. Let me know what you would prefer.

mshanemc commented 4 years ago

@bernadettebuck I'd love to have your fix attempt. I'm almost at the "give up and just let the name be a timestamp or whatever" because

  1. this limit has been painful
  2. it's not using that look up anything...it's more for making the admin's life easier. So they could just look at the other fields on the setting like the real code does to figure out which is which.

This name thing was more because 1) they have to have a name 2) I was trying to make it something friendly.