- Home
- Technical Library
- Boards
- Cookbook
- Code Share
- Blogs
- Partners
-
More
-
Services
- Training & Certification
- Support
-
Galleries
- Force.com Sites Gallery
- Chatter Challenge Entries
-
Other Web Sites
- Salesforce.com
- Database.com
- AppExchange
- CRM Community
-
Discussions
- Announcements
- General Development
- Schema Development
- New to Cloud Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules Discussion
- Security
- Mobile
- Force.com Sites
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby Development
- Adobe Flash Builder for Force.com
- Desktop Integration
- REST API Integration
- Streaming API
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- Excel Connector
- AJAX Toolkit & S-controls
- Force.com Builder & Native Apps
- AppExchange Directory & Packaging
- Force.com Labs Projects
- Open Source
- Site.com
- Jobs Board - Administrators
- Jobs Board - Developers
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- AppExchange Directory & Packaging
- :
- Testing LMA License Activation
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Testing LMA License Activation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-23-2011 01:03 PM
Hi. I am in the process of providing some automation for my sales teams LMO. My code is trying to set the status of a license to Active and this is failing with a validation error. The code is running in a test org. The licence, package version, and package have been created in a test method.
Have I missed some vital data from one of the LMA objects or is there some magic to changing the license status?
This error is raised on the update of the license:
20:49:10.362 (362243000)|EXCEPTION_THROWN|[39]|System.DmlException: Update failed. First exception on row 0 with id a06D000000PVrETIA1; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Argument 1 cannot be null: []
The test code is:
sfLma__Package__c pkg = new sfLma__Package__c(
Name = 'Licence Testing',
sfLma__Release_Date__c = Date.parse('01/01/2010'),
sfLma__Package_ID__c = '033A00000000000IAA' );
insert pkg;
sfLma__Package_Version__c pkgVer = new sfLma__Package_Version__c(
Name = 'Licence Testing Jan 2010',
sfLma__Version__c = 'Jan-10',
sfLma__Version_ID__c = '04tA00000000000IAA',
sfLma__Package__c = pkg.Id,
sfLma__Release_Date__c = Date.parse('01/01/2010') );
insert pkgVer;
Lead ld = new Lead(
LastName = 'Customer',
FirstName = 'Test',
Company = 'MyTestCompany',
Email = 'test@MyTestCompany.com',
sfLma__Subscriber_Org_Type__c = 'EE' );
insert ld;
sfLma__License__c testLic = new sfLma__License__c(
sfLma__Lead__c=ld.Id,
sfLma__Status__c='Trial',
sfLma__Package_Version__c=pkgVer.Id,
sfLma__Seats__c=40,
sfLma__Subscriber_Org_ID__c = UserInfo.getOrganizationId(),
sfLma__Package_License_ID__c='Testing',
sfLma__Used_Licenses__c=22 );
insert testLic;
System.debug([Select sfLma__Used_Licenses__c, sfLma__Subscriber_Org_ID__c, sfLma__Status__c, sfLma__Seats__c, sfLma__Proxy_User__c, sfLma__Package_Version__c, sfLma__Package_License_ID__c, sfLma__Licensed_Seats__c, sfLma__License_Type__c, sfLma__License_Status__c, sfLma__Lead__c, sfLma__Install_Date__c, sfLma__Help__c, sfLma__Expiration__c, sfLma__Expiration_Date__c, sfLma__Contact__c, sfLma__Account__c, RecordTypeId, Name, Id From sfLma__License__c WHERE Id=:testLic.Id]);
testLic.sfLma__Status__c='Active';
update testLic;
Thanks.
- Andy
Re: Testing LMA License Activation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-24-2011 02:15 PM
I don't believe that will work. You are trying to active a license record that doesn't exist in the subscriber org. When you are inserting the license, you are setting it to an org Id. But there is no real LMA license in that org, so when you update it, it will fail activation.
Why do you need to write LMA test methods?
Re: Testing LMA License Activation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-24-2011 10:58 PM
Thanks for the response. I have built a self-service portal for my customers so they can purchase our products online. I obviously need to test the activation system before we start accepting money. Using a fake license allows me to reset the system so I can test all the possible scenarios. I really don’t want to repeatedly request new test orgs to act as fake customers.
I had assumed the LMA developers would have anticipated this need and have written the code to allow it to be tested, either by setting certain license values to null or to hard-coded ids. There must be some mechanism as they to test the LMA system themselves.

