• Dippan Patel
  • NEWBIE
  • 90 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 21
    Questions
  • 14
    Replies
Hi, 

I am using LightningRecordEdit Form. All the fields are displayed correctly in this format 
 
<lightning:inputField fieldName="{!field.apiName}" class="uiInput uiInput--default"/>


However,
I am getting the error when State and Country picklist is enabled in org. 

Both Picklists are disabled as there is no picklist value available.

Error: 
inputField.js: Could not find picklist values for field [StateCode] 
inputField.js: Could not find picklist values for field [CountryCode]


Can anybody please help me with the above issue? 

Thank you. 
Hi, 

I am using LightningRecordEdit Form. All the fields are displayed correctly in this format 
 
<lightning:inputField fieldName="{!field.apiName}" class="uiInput uiInput--default"/>

However,
I am getting the error when State and Country picklist is enabled in org. 

Both Picklists are disabled as there is no picklist value available.

Error: 
inputField.js: Could not find picklist values for field [StateCode]

inputField.js: Could not find picklist values for field [CountryCode]

Can anybody please help me with the above issue? 

Thank you. 
 
Hi, 

I want to run a SourceCode scan for my latest version of the package. But whenever I login to scanner and select the org id and package id, I cannot find the latest version in the dropdown. 

My latest version should be something like 1.375 and in the dropdown I have 1.325, 1.324, 1.323. 

What can be reason for this? 

Thank you,
Dippan 
Hi, 

I want to get recordtypeId and recordtypeName in Sobject if that exists.. For example, 
List<RecordType> recordTypeList;
try{
    recordTypeList = [select Id,Name from RecordType where sObjectType = 'Account'];
    System.debug('recordTypeList' + recordTypeList);
	if(!recordTypeList.isEmpty()){
        System.debug('inside if recordTypeList');
    	Account existingAccount = [select Id,RecordTypeId,RecordType.Name from Account where Id = '0010r00000xxxx'];
        System.debug('existingAccount' );
    }                        
}
catch(Exception e){
           System.debug(LoggingLevel.ERROR, 'Exception:  ' + e.getMessage());
}

The above code gives compilation error, 

Line: 7, Column: 32
select Id,RecordTypeId,RecordType.Name from ^ ERROR at Row:1:Column:11 No such column 'RecordTypeId' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.


What should be the right approach for the above scenario? 

Thank you! 
Hi All, 

Can anybody provide me a link to a managed package that might have deprecated fields on either of Leads or Contacts or Accounts? 

I've installed several free apps from Appexchange but no luck yet. 

If you know any, can you please let me know? 

Thank you,
Dippan 
Hi All, 

Is there a way to get all the deprecated fields of managed package from Lead? 

I have many fields on page layouts of Leads which are deprecated by the managed package. I want to get a list of all such fields using apex. 
Hi,
 
I have After Update Trigger with two dynamic filter criteria and they are in "OR". 
Example: If Lead Source Data Value Changes ---> process record 
OR
If Email Opt Out Data Value Changes --> process record. 

Now, I also have a workflow with condition on any update on record. 
Example: If Email Opt out is FALSE, then change it to TRUE. 

Steps of Execution: 
1. If you change Lead Source manually, trigger fires. 
2. Workflow fires to change Email Opt Out to TRUE. 
3. And Trigger fires again. 

I only want my Trigger to fire once. How do I prevent trigger executing twice without changing workflows and filter criteria?

Thank you.  
Hi, 

I have a package which is due for it's security review. However I'm not ready to release a new version on appexchange yet. Can I send the same package for periodic review? Or is it necessary to have a newer version of package? 

Thank you
Hi, 

If I install a managed package for admin and the package has triggers on after-insert  after-update and other classes. Now if a record is created by a user who do not have access to that trigger and classes, will it execute after insert and after update trigger?

Thanks!
Hi All, 

I have a managed package connected to my production org - where licensing is setup. 
​​​​
I have a user who has installed the package which created a License in my org. Even though I upgrade the license, user still sees it as expired. Below is the screenshot of the license in users org and expiration date in my prod org. 

Any idea why it is not upgrading in user's org? 
User-added imageUser-added image
string server = null;
String host = URL.getSalesforceBaseUrl().getHost();
if(host.split('\\.')[2] == 'visual'){
	server = host.split('\\.')[1];            
}
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint('https://' + server + '-api.salesforce.com/services/data/v34.0/sobjects/' + objName + '/describe/layouts/' + recordTypeId);
req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId());
req.setHeader('Sforce-Call-Options', 'client=x');
Http http = new Http();
HTTPResponse res;
res = http.send(req);

This gives response: 

Request
|System.HttpRequest[Endpoint=https://na70-api.salesforce.com/services/data/v34.0/sobjects/Account/describe/layouts/01280000000HmSj, Method=GET]

Response
System.HttpResponse[Status=Service Unavailable, StatusCode=503] 

I also checked  
https://status.salesforce.com/instances/NAX/maintenances and looks all good. 

Can anybody help me figure out why is this occurring for a particular instance only? 
Hi All, 

I have hardcoded client id and client secret in my code. Salesforce review mentioned to use protected custom settings to store sensitive information. 

So, I created a protected custom setting with two fields client id and client secret. I saved the values in it at  Default Organization Level Value. This custom setting is added to my managed package.

I am able to access it in the developer org, but if my package is installed in another org, it returns null. Below is the code used to access the client id
Access_Key__c authTokenSetting = Access_Key__c.getOrgDefaults();
String rawcryptoKey = authTokenSetting.UniqueEntry__Crypto_Key__c;
System.debug(LoggingLevel.DEBUG, 'Raw crypto key:    ' + rawcryptoKey);

 
Hi All, 

I want Salesforce instance name to add a remote site.
Below is my code: 
String host = URL.getSalesforceBaseUrl().getHost();
String server = host.split('\\.')[1];
String direct =  'https://' + server + '-api.salesforce.com';

I get proper server names such as CS10, CS94 in case of Developer orgs and production. 

However, in case of some sandboxes, I get server as visualforce.
 
Due to this the variable direct turns out to be https://visualforce-api.salesforce.com instead of https://yourdomain-api.salesforce.com

Not able to understand why? 
        
 
global without sharing class addSectionScript implements InstallHandler {
	global void onInstall(InstallContext context) {
		
		try{
	        if(context.isUpgrade() || context.isPush()){
	        	System.debug(LoggingLevel.ERROR,'Instllation is Upgrade or Push. Adding secion to layout.');
	        	
	            //Add Section Through the Metadata API
	            List<String> componentNameList = new List<String>{'Custom_Object_Analysis__c-Custom_Object Analysis Layout'};
		        List<Metadata.Metadata> components = Metadata.Operations.retrieve(Metadata.MetadataType.Layout, componentNameList);     
	            Metadata.Layout la =(Metadata.Layout) components.get(0); 

	            // Create Section
	            Metadata.LayoutSection sec = new Metadata.LayoutSection();
	            sec.customLabel = true;
	            sec.detailHeading = true;
	            sec.editHeading = true;
	            sec.label = 'RingLead Data Quality Score';
	            sec.style = metadata.LayoutSectionStyle.OneColumn;

	            // Create Layout Field
	            Metadata.LayoutItem layoutField = new Metadata.LayoutItem();
	            layoutField.page_x = 'Custompage';
	            layoutField.height = 550;
	            layoutField.width = '100%';

	            // Add Layout Field and Column to Section
	            Metadata.LayoutColumn col1 = new Metadata.LayoutColumn();
	            col1.layoutItems.add(layoutField);
	            sec.layoutColumns.add(col1);
	            la.layoutSections.add(sec);

	            // Deploy it to Layout of User.
	            Metadata.DeployContainer dc = new Metadata.DeployContainer();
	            addSectionScriptCallback callback = new addSectionScriptCallback();
	            dc.addMetadata(la);
	            if(!Test.isRunningTest()){
	            	
	            	Id jobid = Metadata.Operations.enqueueDeployment(dc,callback);
	            	System.debug(LoggingLevel.ERROR,'id is:'+jobid);
	            	
	        	}
	        }
    	} catch(Exception e){
    		System.debug(LoggingLevel.ERROR,'Error in Post Script.');
    		sendTestEmail('Error in post install script.' + e.getStackTraceString());
    	}
    }

    public void sendTestEmail(String body){
        
    }
}

I am trying to change the page layout of the custom object when a user upgrades the package using Metadata. 

I am using this code to upgrade the page layout. But when tried to enque the deployment it gives this error. 

Fatal Error
INSUFFICIENT_ACCESS: insufficient access rights on cross-reference id

 
Hi All, 

I have a managed packaged installed in production. It works well in prod but not in full copy sandbox. What can be the issue? 

Thanks,
Dippan 
Hi, 

I have a visualforce page with lightningStylesheets="true" and I am using it in lightning. BUt in lightning, there is no select button for the multiselect picklist (in the image below). Any suggestions for what am I missing? 

User-added image
Hi, 

How should I get a createdDate for the custom field using Apex? 
Hi, 

I have a list with the following format in apex controller. 

Custom__Object_Analysis__c:{Id=a0L1N00000L1izqUAB, Name=All Accounts, CreatedDate=2018-02-15 15:15:12, isCustom__c=false, Fields__c=0, Filter__c=Industry = '', Object_Name__c=account, Tally__c=0}

How do I serialize this? 
JSON.Serialize() gives Uncaught SyntaxError: Unexpected string 
Hi All, 

I have a custom validation error, it is getting displayed on visual force page but my save button keeps running. Below is the screenshot for that. User-added image
<apex:form>

    <apex:pageMessages id ="showmsg"></apex:pageMessages>
    <apex:actionfunction name="lookupDetail" action="{!lookupDetail}" rerender="pnlScriptDupes" />


     <apex:actionfunction name="action_onSave" action="{!onSave1}" oncomplete="testfunc();" rerender="pnlScriptDupes" />
 
 
    <apex:actionfunction name="action_onCancel" action="{!Cancel}" />

    <apex:dynamiccomponent componentvalue="{!Ext.dynamicPageBlock}" rendered="
    
    </apex:pageblock>
    <apex:outputpanel id="pnlScriptDupes">
     
      <div id="pnl-hdn-messages" style="display:none">
      </div>
      
    </apex:outputpanel>
  </apex:form>
 
public PageReference onSave1(){
        Account a = (Account)con.getRecord();

        try{
            insert a;

            String id = ApexPages.CurrentPage().getParameters().get('id');
          
            PageReference ref = new PageReference('/'+a.id);
            ref.setRedirect(true);
            return ref;
        }
        catch(Exception ex){
           
            System.debug(LoggingLevel.ERROR, 'saveError:' + saveError);
            ApexPages.addMessages(ex);
            System.debug(LoggingLevel.ERROR, 'ERROR:  ' + ex);
            System.debug(LoggingLevel.ERROR, 'Inside Catch');
            

        }
       
        return null;
    }



 
Hi All, 

I want to reference a relational field in custom object. For example, Select ID, Contact__r.Name from x_Report__c gives unrecognized property exception in JAVA. 
Hi, 

If I install a managed package for admin and the package has triggers on after-insert  after-update and other classes. Now if a record is created by a user who do not have access to that trigger and classes, will it execute after insert and after update trigger?

Thanks!
Hi, 

I want to run a SourceCode scan for my latest version of the package. But whenever I login to scanner and select the org id and package id, I cannot find the latest version in the dropdown. 

My latest version should be something like 1.375 and in the dropdown I have 1.325, 1.324, 1.323. 

What can be reason for this? 

Thank you,
Dippan 
Hi All, 

Can anybody provide me a link to a managed package that might have deprecated fields on either of Leads or Contacts or Accounts? 

I've installed several free apps from Appexchange but no luck yet. 

If you know any, can you please let me know? 

Thank you,
Dippan 
Hi All, 

Is there a way to get all the deprecated fields of managed package from Lead? 

I have many fields on page layouts of Leads which are deprecated by the managed package. I want to get a list of all such fields using apex. 
//Visualforce page for pageBlockTable

<apex:page standardController="Loan__c" extensions="AmoSchedRelatedListExtension">
    <apex:pageBlock title="">
        <apex:pageBlockTable value="{!Loan__c.amortization_line_items__r}" var="ali">
            <apex:column value="{!ali.Period__c}"/>
            <apex:column value="{!ali.Month__c}"/>
            <apex:column value="{!ali.Principal_Balance__c}"/>
            <apex:column value="{!ali.Monthly_Payment1__c}"/>
            <apex:column value="{!ali.Interest__c}"/>
            <apex:column value="{!ali.Principal_Payment__c}"/>
            <apex:column value="{!ali.Consulting_Fee__c}"/>
            <apex:column value="{!ali.Adjusted_Principal__c}"/>
            <apex:column value="{!ali.Adjusted_Consulting_Fee__c}"/>
            <apex:column value="{!ali.Total_Payment__c}"/>
            <apex:column value="{!ali.Remaining_Principal_Balance__c}"/>
            <apex:column value="{!ali.Interest_Payments_Received__c}"/>
            <apex:column value="{!ali.Consulting_Fee_Payments_Received__c}"/>
            <apex:column value="{!ali.Principal_Payments_Received__c}"/>
            <apex:column value="{!ali.Total_Payments_Received__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>
 
//Apex Class attempting to order the block table in ascending order by Period

public with sharing class AmoSchedRelatedListExtension
{
    private final Id loanId;
    public List<Amortization_Line_Item__c> alis { get; set; }
 
    public AmoSchedRelatedListExtension(ApexPages.StandardController stdController)
    {
        loanId = stdController.getId();
        alis = [select Id
                              ,Period__c
                              ,Month__c
                              ,Principal_Balance__c
                              ,Monthly_Payment1__c
                              ,Interest__c
                              ,Principal_Payment__c
                              ,Consulting_Fee__c
                              ,Adjusted_Principal__c
                              ,Adjusted_Consulting_Fee__c
                              ,Total_Payment__c
                              ,Remaining_Principal_Balance__c
                              ,Interest_Payments_Received__c
                              ,Principal_Payments_Received__C
                              ,Consulting_Fee_Payments_Received__c
                              ,Total_Payments_Received__c
                     from Amortization_Line_Item__c
                   where Loan__c =:loanId
               order by Period__c ASC];
    }
}
Hi everyone,

I'm attempting to add a visualforce page to a lightning record page that displays the related Amortization Line Items of a Loan. Both Loan and Amortization Line Item are custom objects. My intent is to use apex:pageBlockTable to display the related list with more than the standard 10 columns (if there is a better way to achieve this, please  recommend).

As you can see my code above, I have the visualforce page and an apex class which I was hoping would correctly order by period ascending (starting at 1 or 0, depending on the loan). 

On one record, it almost worked but it started at period 4, listed the remaing rows correctly until the final period 36 and then just had no order to it for periods 2, 3, and 1. Other records just order by Period descending.

Any help is much appreciated. Thank you!
User-added image
User-added image
Hi All, 

I have a managed package connected to my production org - where licensing is setup. 
​​​​
I have a user who has installed the package which created a License in my org. Even though I upgrade the license, user still sees it as expired. Below is the screenshot of the license in users org and expiration date in my prod org. 

Any idea why it is not upgrading in user's org? 
User-added imageUser-added image
Hi All, 

I have hardcoded client id and client secret in my code. Salesforce review mentioned to use protected custom settings to store sensitive information. 

So, I created a protected custom setting with two fields client id and client secret. I saved the values in it at  Default Organization Level Value. This custom setting is added to my managed package.

I am able to access it in the developer org, but if my package is installed in another org, it returns null. Below is the code used to access the client id
Access_Key__c authTokenSetting = Access_Key__c.getOrgDefaults();
String rawcryptoKey = authTokenSetting.UniqueEntry__Crypto_Key__c;
System.debug(LoggingLevel.DEBUG, 'Raw crypto key:    ' + rawcryptoKey);

 
Hi All, 

I want Salesforce instance name to add a remote site.
Below is my code: 
String host = URL.getSalesforceBaseUrl().getHost();
String server = host.split('\\.')[1];
String direct =  'https://' + server + '-api.salesforce.com';

I get proper server names such as CS10, CS94 in case of Developer orgs and production. 

However, in case of some sandboxes, I get server as visualforce.
 
Due to this the variable direct turns out to be https://visualforce-api.salesforce.com instead of https://yourdomain-api.salesforce.com

Not able to understand why? 
        
 
Hi All, 

I have a managed packaged installed in production. It works well in prod but not in full copy sandbox. What can be the issue? 

Thanks,
Dippan 
Hi Everyone, 

I want to override custom object new button with my visualforce page. After selecting the page to override on the custom object new button, I am getting the below error.  Error overriding visualforce page