• Michael Paisner
  • 9 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 10
I am having an issue with async apex executions hitting their limits very quickly. Hoping to find a way to watch that and see what's causing the issues.
I have a lightning component that implements lightning:actionOverride how do I get the recordId of the parent when the action is triggered from a related list?
Dear Sir/Madam,
Suppose I have an input string "abc,efg,hijk", I want to count how many commas are included in the string (in this example, I want to return 2 since there are 2 commas). I searched around but found nothing. There is a similar post with no solution: https://developer.salesforce.com/forums/?id=906F0000000D8qKIAS

Thank you for the help.
I have an visualforce page which calls custom controller.A method getIFrameSrc gets the ifRame URL.That URL i have to pass it to visualforce page <apex:iframe>.I am able to pass it.But i am getting a blank page.
VF Page Code
<apex:page sidebar="false"  controller="CXiIntercept3">
<!--<apex:stylesheet value="{!URLFOR($Resource.paymetricsCSS, 'paymetricsCSS.css')}"/>-->
  <apex:form >
  <!--<apex:actionFunction name="getIFrameSrc" action="{!getIFrameSrc}" rerender="out" status="myStatus"/>-->
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="cache-control" content="no-cache, no-store, max-age=0, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <title>XiIntercept v3 - Implementation Demo</title>
    <script type="text/javascript">
<form id="form1">
            <p>This sample shows the basic functionality of implementing the iframe solution.</p>
            <!--<iframe id="IFrame" name="dieCommFrame" frameBorder="0" src="http://www.w3schools.com"></iframe>-->
            <apex:iframe id="dieCommFrame" frameborder="0" src="{!getIFrameSrc}"/>
             <!--<apex:commandButton value="Load" action="{!getIFrameSrc}"/>-->
              <!--<apex:commandLink action="{!getIFrameSrc}" value="Load" id="theCommandLink"/>-->
            <!--<apex:param name="strSrcURL"
            <p />
                        <th colspan="2">Billing Address</th>
                        <td class="Column1">Name</td>
                        <td class="Column2">
                        <input id="Text1" type="text" value="John Doe" size="32" /></td>
                        <!--<apex:InputField label="Name" id="Text1" value="John Doe"/>-->
                        <td class="Column1">Address</td>
                        <td class="Column2"><input id="Text2" type="text" value="19500 State Hwy 249" size="32" /></td>
                        <td class="Column1">City</td>
                        <td class="Column2"><input id="Text3" type="text" value="Houston" size="32" /></td>
                        <td class="Column1">State</td>
                        <td class="Column2"><input id="Text4" type="text" value="Texas" size="16" /></td>
                        <td class="Column1">Zip Code</td>
                        <td class="Column2"><input id="Text5" type="text" value="77070" size="8" /></td>
                        <td class="Column1">&nbsp;</td>
                        <td class="Column2">&nbsp;</td>
                        <td class="Column1">&nbsp;</td>
                        <td class="Column2">
                              <!--<apex:commandButton id="cmdPayment" action="{!submitForm}" value="Tokenize Data"/>-->
                         <input id="cmdPayment" type="button" onclick="submitForm(); return false;" value="Tokenize Data" />
Apex Class Code is given below
public with sharing class CXiIntercept3

   /*public CXiIntercept3(ApexPages.StandardController controller) {
       m_strURL = 'https://qaapp02.xisecurenet.com/diecomm';
        m_strGUID = '8842aa98-d6d1-40a4-9ee0-c02a3393b7af' ;
        m_strPSK = '4Kb/=5ZkrX{7_3HcTt8+!Md6C2$e9}aJ' ;

    public String getIFrameSrc { get;
        System.debug('Inside IFrameSrc');
        String strWhere = 'getIFrameSrc';
        System.debug('strWhere is'+strWhere);
        String strAccessToken = getIFrameAccessToken();
        String strSrcURL = m_strURL + '/view/iframe/' + m_strGUID + '/' + strAccessToken + '/true';
        Log(strWhere, 'IFrameSrc', strSrcURL);
        System.debug('iFrame URL is'+strSrcURL);
        getIFrameSrc = strSrcURL;
        System.debug('getIFrameSRc is'+getIFrameSrc);
        //return strSrcURL;
    public PageReference submitForm() {
        /*pageReference acctPage = new PageReference('https://cynosure--slqa--c.cs19.visual.force.com/apex/Paymetrics_Page');
        return null ;    }

    public String m_strURL;
    public String m_strGUID;
    public String m_strPSK;
    public CXiIntercept3()
        m_strURL = 'https://qaapp02.xisecurenet.com/diecomm';
        m_strGUID = '8842aa98-d6d1-40a4-9ee0-c02a3393b7af' ;
        m_strPSK = '4Kb/=5ZkrX{7_3HcTt8+!Md6C2$e9}aJ' ;

    public String getIFrameSrc()
        System.debug('Inside IFrameSrc');
        String strWhere = 'getIFrameSrc';
        System.debug('strWhere is'+strWhere);
        String strAccessToken = getIFrameAccessToken();
        String strSrcURL = m_strURL + '/view/iframe/' + m_strGUID + '/' + strAccessToken + '/true';
        Log(strWhere, 'IFrameSrc', strSrcURL);
        System.debug('iFrame URL is'+strSrcURL);
        return strSrcURL;
    public String getIFrameAccessToken()
        String strAT = '';
        String strResponse = '';
        String strURL = m_strURL + '/AccessToken';
        String strWhere = 'getSignedXML';
        StaticResource static_resource = [Select Body From StaticResource Where Name = 'Paymetrics_CSS'];
        String strXml = static_resource.body.toString();
        System.debug('strxml is'+strxml);
        //String strXml = '';
        //String strXml = getIFrameMerchantHTML();
        String strSignature = '';
        Dom.Document hDoc = null;
        Dom.XmlNode hRoot = null;
        Dom.XmlNode hResponse = null;
        Dom.XmlNode hAT = null;
        System.debug('packet ' + EncodingUtil.urlEncode(strXml, 'UTF-8'));
        String strPostXml = 'MerchantGuid=' + m_strGUID + '&' +
                    'SessionRequestType=1&' +
                    'Packet=' + EncodingUtil.urlEncode(strXml, 'UTF-8') + '&' +
                    'Signature=' + EncodingUtil.urlEncode(getDigitalSignature(strXml), 'UTF-8') + '&' +
        System.debug('strPostxml is ' +strPostXml);
        //System.debug('packet ' + EncodingUtil.urlEncode(strXml, 'UTF-8'));
        //Log(strWhere, 'strXml', strXml);
        //Log(strWhere, 'strPostXml', strPostXml);
        //Log(strWhere, 'strSignature', strSignature);
        hDoc = executeHttpRequest(strURL, strPostXml, 'POST');
        hRoot = hDoc.getRootElement();
        if(hRoot != null)
            hResponse = hRoot.getChildElement('ResponsePacket', null);
            if(hResponse != null)
                hAT = hResponse.getChildElement('AccessToken', null);
                if(hAT != null)
                    strAT = hAT.getText();
        Log(strWhere, 'AccessToken', strAT);
        System.debug('Access Token is'+strAT);
        return strAT;
    public String getXmlRequest()
        String strWhere = 'getXmlRequest';
        //String strRedirect = getRequestUrl();
        String strRedirect = '';
        String xmlRequest = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';

        //strRedirect = strRedirect.replace('XiIntercept3RQ', 'XiIntercept3RS');
        xmlRequest += '<PostPacketModel><RedirectUri>' + strRedirect + '</RedirectUri></PostPacketModel>';
        Log(strWhere, 'strRedirect', strRedirect);
        Log(strWhere, 'xmlRequest', xmlRequest);
        return xmlRequest;
    /*public String getIFrameMerchantHTML()
        /* code snippet to retrieve merchant xml into string */
            String strURL = '' + Site.getBaseUrl();
            if(strURL.length() == 0)
                strURL = URL.getCurrentRequestUrl().toExternalForm().replace('XiIntercept3RQ', 'XiIntercept3RS');
            else strURL += '/XiIntercept3RS';
            String xmlRequest = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
   // }
    private void Log(String strWhere, String strName, String strValue)
        System.debug(strWhere + '() - ' + strName + ' => ' + strValue);

    private String getDigitalSignature(String strData)
        String strWhere = 'getDigitalSignature';
        String strSignature = '';
        strSignature = EncodingUtil.base64Encode(Crypto.generateMac('hmacSHA256', Blob.valueOf(strData), Blob.valueOf(m_strPSK)));
        System.debug('strsignature is'+strsignature);
        Log(strWhere, 'strData', strData);
        Log(strWhere, 'strSignature', strSignature);
        return strSignature;

    private Dom.Document getResponsePacket(String strAccessToken)
        String strWhere = 'getResponsePacket';
        String strSignature = getDigitalSignature(strAccessToken);
        String strUrlParams = m_strURL + '/ResponsePacket';
        Dom.Document hDoc = null;
        strUrlParams += '?MerchantGUID=' + m_strGUID;
        strUrlParams += '&Signature=' + EncodingUtil.urlEncode(strSignature, 'UTF-8');
        strUrlParams += '&AccessToken=' + strAccessToken;
        Log(strWhere, 'strUrlParams', strUrlParams);
        hDoc = executeHttpRequest(strUrlParams, '', 'GET');
        Log(strWhere, 'hDoc.toXmlString()', hDoc.toXmlString());
        return hDoc;
    private Dom.Document executeHttpRequest(String targetURL, String urlParameters, String requestType)
        String strWhere = 'executeHttpRequest';
        Dom.Document hDoc = null;
        Http myHttp = new Http();
        HttpRequest httpRQ = new HttpRequest();
        HttpResponse httpRS = null;
        Log(strWhere, 'targetURL', targetURL);
        Log(strWhere, 'requestType', requestType);
        Log(strWhere, 'urlParameters', urlParameters);
            httpRQ.setHeader('Content-Type', 'application/x-www-form-urlencoded');
            httpRQ.setHeader('Content-Length', String.valueOf(urlParameters.Length()));
            httpRQ.setHeader('Content-Language', 'en-US');
            httpRQ.setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate');
            httpRQ.setHeader('Pragma', 'no-cache');
        httpRS = myHttp.send(httpRQ);
        if(httpRS != null)
            Log(strWhere, 'httpRS.getBody()', httpRS.getBody());
            hDoc = httpRS.getBodyDocument();
            hDoc = new Dom.Document();
        return hDoc;
Any suggestions are welcome..
in package.xml just pulls the connected app configuration, the .profile files do not have a mention of the connected app even when the app is assigned to the profile, what tag to use to pull connected app profile permissions using package.xml 
  • January 18, 2016
  • Like
  • 1
How to retrieve or deploy Custom Metadata Records by ANT Migration Tool?

Is this possible?

I guess it should be possible if this is available for packages and changesets but can't find a way out to do this.

How to do this?

Found some article about this here:

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_custommetadata.htm#meta_custommetadata<types> <members>*</​members> <name>Custom​Metadata</name> </types>I see errorpackage.xml - Entity type: 'Custom​Metadata' is unknownDoes anyone knows how to overcome this error?

This should be working since version 31 but it is not working even in version 35.0
I am trying to copy workflows (field updates and rules) from one org to another using eclipse force.com ide.  I used this source code copy/paste method for fields, validation rules, record types, etc. with no problem.  What went wrong?  I am getting "Error parsing file: Element fieldUdates is duplicated at this location in type Workflow"
Any idea how to fix this?
In my test class I insert new products and pricebookentries, in my test class I don't use seeAllDate=true annotation and in order to retrieve standard pricebook id I used Test.getStandardPricebookId() method, here's my code:
Product2 p1 = new Product2(Name='Product Monthly 1111', Family='Monthly', isActive=true, CurrencyIsoCode='USD');
Product2 p2 = new Product2(Name='Product Yearly 2222', Family='Yearly', isActive=true, CurrencyIsoCode='USD');

insert new List<Product2>{p1, p2};

Id pricebookId = Test.getStandardPricebookId();

PricebookEntry pbe1 = new PricebookEntry(Pricebook2id=pricebookId, Product2id=p1.ID, isActive=true, CurrencyIsoCode='USD', unitPrice=100);
PricebookEntry pbe2 = new PricebookEntry(Pricebook2id=pricebookId, Product2id=p2.ID, isActive=true, CurrencyIsoCode='USD', unitPrice=50);

insert pbe1;
insert pbe2;

List<PricebookEntry> pbes = [SELECT ID FROM PricebookEntry 
    WHERE Product2id IN (:p1.Id, :p2.Id) AND Pricebook2.isStandard = TRUE AND Pricebook2.isActive = TRUE AND CurrencyIsoCode = 'USD' AND isActive = TRUE];

System.assertEquals(2, pbes.size());

pbes.size() returns 0. I used the same query in console for existing data and I got results. What am I doing wrong?

We are buiding a system that will automatically provision License Seats when a customer purchases our product from our custom store front. All of this logic is in Apex and we are trying to write tests to ensure this works correclty but it seems this may not be possible.


In its simplest form the test would pefrom the following:

- Create a License

- Update the Seats__c field on the license

- Assert Seat__c field was updated correctly


Seem simple but it doesn not appear to work as this is the error received when trying to accomplish this: 

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:


//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 lic;


Any ideas?




  • September 16, 2013
  • Like
  • 0