+ Start a Discussion
TehNrdTehNrd 

What are the required fields for updating LMA License record?

I'm writing some tests that insert and update an LMA license record but my updates are failing with the following error:

 

Update failed. First exception on row 0 with id a07e0000000ySK2AAM; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Argument 1 cannot be null: []

 

Below is the code to reproduce:

 

sfLma__License__c lic = new sfLma__License__c(
sfLma__Status__c = 'Active',
sfLma__Seats__c = 0
); insert lic; lic.sfLma__Seats__c = 5; update lic;

 

This looks to be coming from inside the LMA app and I am probaby not setting the the correct "required" fields on the License record. Anyone know what the minimun required fields are to peform an update DML on the License record?

TehNrdTehNrd

Below also fails.

 

//Create account license can be attached to
Account acct = new Account(Name = 'test'); insert acct;
//Create package sfLma__Package__c pack = new sfLma__Package__c( Name = 'test', sfLma__Developer_Name__c = 'test', sfLma__Developer_Org_ID__c = 'abc', sfLma__Latest_Version__c = '3', sfLma__Lead_Manager__c = UserInfo.getUserId(), sfLma__Package_ID__c = '3', sfLma__Release_Date__c = system.today().addDays(-30) ); insert pack;
//Create a package version sfLma__Package_Version__c packVersion = new sfLma__Package_Version__c( Name = 'test', sfLma__Package__c = pack.id, sfLma__Is_Beta__c = false, sfLma__Release_Date__c = system.today(), sfLma__Sequence__c = 1, sfLma__Version__c = '3', sfLma__Version_ID__c = '3' ); insert packVersion;
//Ceate a license record Id recordTypeId = [select Id from RecordType where Name = 'Active' and SobjectType = 'sfLma__License__c'].Id; sfLma__License__c lic = new sfLma__License__c( RecordTypeId = recordTypeId, sfLma__Status__c = 'Active', sfLma__Seats__c = 1, sfLma__License_Type__c = 'Editable', sfLma__Account__c = acct.Id, sfLma__Expiration__c = system.today().addDays(365), sfLma__Install_Date__c = system.today(), sfLma__Package_Version__c = packVersion.Id ); insert lic;
//Update the Seats field on the license lic.sfLma__Seats__c = 5;
//UPDATE FAILS update lic;