• pradeep kumar yadav
  • NEWBIE
  • 328 Points
  • Member since 2017
  • Salesforce Developer
  • Persistent Systems


  • Chatter
    Feed
  • 3
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 103
    Replies
i want to update the object permission. for that i want to fetch only those object whose permission we can update.
because in object describe call only we can check object is creatable,updatable etc. there is no option for permissionable check. 
Hi all

I have a trigger that creates new child records from a parent. Parent is called Roll Out and the Child is called Cost Estimate. I would like that should it be refired that it checks for existing records before so as it avoid duplication. The duplicate check should be on the value and the the desitnation. 

Any assistance with the duplication check and also ensuring that the code is bulkified will be appreciated.  
 
rigger AutoCreateCostEstimates on Roll_Out__c (after insert, after update) {

    List<Cost_Estimate__c> interviewers = new List<Cost_Estimate__c>();
    List<string> Temp;


    for (Roll_Out__c newPosition: Trigger.New) {
      if (newPosition.Destinations__c != null && newPosition.Create_Roll_Out__c == True){
            // split out the multi-select picklist using the semicolon delimiter
            for(String destinationlist: newPosition.Destinations__c.split(';')){
                interviewers.add(new Cost_Estimate__c(
                Client_Name__c = newPosition.Client_Name__c,
                Shipment_Value_in_USD__c = newPosition.Shipment_Value_in_USD__c,
                Destination__c = destinationlist,
                Roll_Out__c = newPosition.Id));
                
            }
        }
        
    }
    insert interviewers;
    
}

 
<apex:pageBlockTable var="exp" value="{!listOfExpense}">
<apex:outputLink value="/{!exp.Id}" target="_blank">{!exp.Name}</apex:outputLink>
        <apex:repeat value="{!fieldSetMember}" var="fs">
                 <apex:column value="{!exp[fs]}" />
                         
          </apex:repeat>
 </apex:pageBlockTable>

 
document.getElementById("ancherId").href = '/' + idArray[i]+'?isToastVisible=true';
In classic ApexPages.currentPage().getParameters().get('isToastVisible'); gives result
But , in case of lightning 'isToastVisible' is not showing in url and ApexPages can't access it.
Can anyone tell reason and give other solution.
I am using this code from this link https://www.lightningdesignsystem.com/components/progress-ring 
 
<div class="slds-progress-ring">
  <div class="slds-progress-ring__progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="100">
    <svg viewBox="-1 -1 2 2">
      <path class="slds-progress-ring__path" id="slds-progress-ring-path" d="M 1 0 A 1 1 0 1 1 1 -2.4492935982947064e-16 L 0 0" />
    </svg>
  </div>
  <div class="slds-progress-ring__content"></div>
</div>


But a round black ring appears.
I tried every documentation and process specified in trailhead https://trailhead.salesforce.com/modules/lightning_design_system/units/lightning-design-system5
 
I have already fetched the value of formula field using Metadata API, and now I want to fetch ObjectNames with field Names .
document.onclick=function(evt){  
        	var target = evt.target;
                alert(target.id);
}

Alert gives undefined in Visualforce Page
I want div ID when click on any div on page. 
Couldn't find any reason why this is happening, found just this old entry (5 years)https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjRwcb9me7WAhWKpo8KHTBkDVAQFgglMAA&url=https%3A%2F%2Fdeveloper.salesforce.com%2Fforums%2F%3Fid%3D906F000000090zcIAA&usg=AOvVaw2NNKDrkeUl8JoViIVsokaN and decided to reply to say this still happens. I just opened a case with Salesforce to see if they know what is going on.

But this happens on my Developer Org.
 
Contacts have child object name "Transaction Entries" .
Community have two tabs HOME & Transaction Entries.
When I login by contact all transaction shows but I want only child transations of that contact show.
All contacts are under same Account.

Is it possible by any method.
I created a list of  type
List< Schema.DescribeFieldResult> fieldDetail
It holds all field related detail to a Object and Use this list in pageBlockTable.

<apex:pageBlockTable value="{!fieldDetail}" var="od">             <apex:column value="{!od.Label}" headerValue="Label"/>             <apex:column value="{!od.Name}" headerValue="API Name"/>              <apex:column value="{!od.Type}" headerValue="Type"/>              <apex:column value="{!od.Createable}" headerValue="isCreatable"/>  </apex:pageBlockTable>


all three columns Label, Name, Type give show result,   but when I add isCreatable column,  It gives ERROR

Unknown property 'Schema.DescribeFieldResult.Createable'
Error is in expression '{!od.Createable}' in component <apex:column> in page objectdetail

Can anyone help to show this column on VF page.

I have an alternative of Wrapper class but I want show using upper Method.
I created a list of  type
List< Schema.DescribeFieldResult> fieldDetail
It holds all field related detail to a Object and Use this list in pageBlockTable.

<apex:pageBlockTable value="{!fieldDetail}" var="od">
            <apex:column value="{!od.Label}" headerValue="Label"/>
            <apex:column value="{!od.Name}" headerValue="API Name"/>
             <apex:column value="{!od.Type}" headerValue="Type"/>
             <apex:column value="{!od.Createable}" headerValue="isCreatable"/>
 </apex:pageBlockTable>

all three columns Label, Name, Type give show result,   but when I add isCreatable column,  It gives ERROR

Unknown property 'Schema.DescribeFieldResult.Createable'
Error is in expression '{!od.Createable}' in component <apex:column> in page objectdetail

Can anyone help to show this column on VF page.........

I have an alternative of Wrapper class but I want show using upper Method...
I created a list of  type
List< Schema.DescribeFieldResult> fieldDetail
It holds all field related detail to a Object and Use this list in pageBlockTable.

<apex:pageBlockTable value="{!fieldDetail}" var="od">             <apex:column value="{!od.Label}" headerValue="Label"/>             <apex:column value="{!od.Name}" headerValue="API Name"/>              <apex:column value="{!od.Type}" headerValue="Type"/>              <apex:column value="{!od.Createable}" headerValue="isCreatable"/>  </apex:pageBlockTable>


all three columns Label, Name, Type give show result,   but when I add isCreatable column,  It gives ERROR

Unknown property 'Schema.DescribeFieldResult.Createable'
Error is in expression '{!od.Createable}' in component <apex:column> in page objectdetail

Can anyone help to show this column on VF page.

I have an alternative of Wrapper class but I want show using upper Method.
I have been facing issue with installation of Force.com IDE in eclipse.
After clicking ADD button, the following error message is displaying.
1.could not find https //developer.salesforce.com/media/force-ide/eclipse42.

Somebody please help me on this.User-added image
 
Hi there,

I am trying following test class with api version 46.
my expected result is as follow.
totalUser = 0 and totalAccount = 0
But totalUser is not 0.
Any suggestion for using with @isTest(SeeAllData = false) User Object?
@isTest(SeeAllData = false)
public class TestClassSample {
    
    private static testMethod void test01() {      
        
        Test.startTest();
        
        System.debug('Total User Record = ' + [Select Count(Id) totalUser From User]);
        
        Test.stopTest();  
    }    
    
    private static testMethod void test02() {      
        
        Test.startTest();
        
        System.debug('Total Account Record = ' + [Select Count(Id) totalAccount From Account]);
        
        Test.stopTest();  
    }
}


Thanks
Regards,
LinThaw
Hi All,

I am fairly new to apex programming and not able to figure out why the following line of code is not working for me :
<apex:outputPanel layout="panel" style="width: 100%" rendered="{IF({!Case.Type}=='Update Account')}">

The requirement is that if the value in Type piclist standard field on case object is Update account then the contect in this panel should be displayed.

Thanks in advance for your help.

Ishaan.
Hello, I've been working to convert this url button: 
/apex/SDOC__SDCreate1?id={!FX5__Quote__c.Id}&Object=FX5__Quote__c
into a lightning component.  I've already built the component button, but i don't know where to put the above url.  In controller?  How would that look?  I've tried figuring it out on trailhead, but it'll take another week before it answers my question.  Any answers would be appreciated.
 

Hi everyone,

In order to have the Global Actions open in the center of the page instead of the standard bottom right side, do I need to build a Custom Lightning Component for it? If so, can you let me know what would be the steps for it and what I should keep in mind for this? I have experience with the Admin side, but close to none in terms of the developer side.
Thank you lots,
Paul

I have an Action button in our lightning Page, upon clicking it shows a form to input couple of fields and save it. But I have to make those input fields readonly for Profile 1 and editable for Profile 2.
Let me know how I can achieve this. If possible within Lightning component itself by checking profile of the current user, As I am already calling server side script upon clicking this button in doinit and form based on the return values. 
Is it possible that i get 2 return values from apex and one of them will be to read the profile and make the input fields readonly. 
Thanks.
In below code i am creating XLS file using lightning javascript controller but it is ending up with creating an xls file how i can create XLSX file?? in the same way if i create xlsx file, file is not opening..


var hiddenElement = document.createElement('a');
        hiddenElement.href = 'data:application/vnd.ms-excel;charset=utf-8' + ',' + encodeURIComponent(csv);
        hiddenElement.download = 'Report.xls'; 
        hiddenElement.style="border: 1.5pt"; 
        document.body.appendChild(hiddenElement); // Required for FireFox browser
        hiddenElement.click();

 
if there and possibility to degrade the api version to 39 so that locker service gets disable.
will the slds works below version 39.
 
Hello everyone,
I want to upload a number of files when I select a value in the picklist.i.e. when I select 2 in picklist then it uploads only two files and so on.
Here is the code what I did to achieve this.
Thanks in advance
VF Page--

<apex:page standardController="Document" extensions="MyDocuments">
  <apex:form >
      <apex:pageBlock >          
          <apex:selectList value="{!len}" size="1">
              <apex:selectOptions value="{!option}"/>
              <apex:actionSupport event="onchange" action="{!uploadMultiFile}" reRender="lab"/>
          </apex:selectList>
      </apex:pageBlock>
      
      <apex:pageBlock title="UpLoad A File">
          <apex:pageBlockSection id="lab">
              <apex:repeat value="{!total}" var="t">
                  <apex:inputFile value="{!doc.body}" fileName="{!doc.name}"/>
              </apex:repeat>
              <apex:commandButton value="Save" action="{!save}"/>

          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

---------------------------------------------------------------------------------------------------------------------
Controller--

public class MyDocuments {
    
    public document doc {get;set;}
    public List<selectOption> option {get;set;}
    public String len {get;set;}
    public Integer total {get;set;}
    
    
    public MyDocuments(ApexPages.StandardController controller) 
    {
        doc = (Document)controller.getRecord();
        doc.folderId = UserInfo.getUserId();
        
        option = new List<selectOption>();
        option.add(new selectOption('','--None--'));
        for(Integer i=1; i<=10; i++)
        {
            option.add(new selectOption('val'+i,string.valueOf(i)));
        }
        
    }
    
    public void uploadMultiFile()
    {
        if(len == 'val1')
        {
            total = 1;
        }
        if(len == 'val2')
        {
            total = 2;
        }
    }

}

 
Hello everyone,

When I am trying to test my class using test setup method then IDE is giving an error. There is any way to avoid this and use both methods during test??

@IsTest
global class AddPrimaryContactTest 
{    
     @TestSetup
    static void setup()
    {
        List<Account> accountList = new List<Account>();
        for(Integer i = 1; i <= 50; i++)
        {
            accountList.add(new Account(name = 'Test Account'+ i, BillingState = 'CA'));
        }
        for(Integer i = 50; i <= 100; i++)
        {
            accountList.add(new Account(name = 'Test Account'+ i, BillingState = 'NY'));
        }
        insert accountList;
    }
    
    @IsTest(SeeAllData=true)
    global static  Void test()
    {
        Contact con = new Contact(Firstname ='conFirst',lastname='conLast');
        AddPrimaryContact obj = new AddPrimaryContact(con,'CG');        
        Test.startTest();
        System.enqueueJob(obj);
        Test.stopTest();
        List<Account> count = [select id,(select id from contacts) from Account where BillingState = 'CA'];
        System.debug('countcontact = ' + count.size() );
        System.assertEquals(50, count.size());        
    }
}


thanks in Advance :)
How to create custom clone button. need to update parent and child records and it need to dynamic which can be used in any object 

like account, oppournity, case ..etc .

Thanks for advance
I have written a post install script, where on installation of package the scheduler class will get schedule. but the code is not working
please check the below code and let me know what is wrong in the code.
global class CX_InstallUninstallHandler implements InstallHandler, UninstallHandler {
    //Installation handler
    global void onInstall(InstallContext context) {
        try {
            List < CronTrigger > listCronTriggerAllScheduledJobs = new List < CronTrigger > ([SELECT CronJobDetail.Name FROM CronTrigger
                WHERE CronJobDetail.Name = 'Schedule job to send reminder email'
                limit 1
            ]);
            for (CronTrigger CronTriggerAllScheduledJobs: listCronTriggerAllScheduledJobs) {
                if ((CronTriggerAllScheduledJobs.CronJobDetail.Name).equalsIgnoreCase('Schedule job to send reminder email')) {
                    // Delete the Scheduled Job
                    System.abortJob(CronTriggerAllScheduledJobs.id);
                    break;
                }
            }

            //Schedule New job
            CX_CertificationUpdateReminderScheduler scheduler = new CX_CertificationUpdateReminderScheduler();
            String schExpression = '0 0 0 * * ?';
            system.schedule('Schedule job to send reminder email', schExpression, scheduler);

            List < CronTrigger > Jobs = new List < CronTrigger > ([SELECT CronJobDetail.Name FROM CronTrigger
                WHERE CronJobDetail.Name = 'Schedule job to send reminder email'
                limit 1
            ]);
            

          // ---------------for deugging---------------
            system.debug('Jobs=' + Jobs[0].CronJobDetail.Name);
            string jobDetails = string.valueOf(Jobs[0].CronJobDetail.Name);
            Exception ex;
            SendFailureEmail('Installation', ex, jobDetails);
          //---------------for debugging----------------------
           
        }
        Catch(Exception e) {
            SendFailureEmail('Installation', e, '');
        }
    }
    //Uninstallation handler
    global void onUninstall(UninstallContext context) {
        try {
            //retrive the scheduled jobs and abort it
            List < CronTrigger > listCronTriggerAllScheduledJobs = [SELECT CronJobDetail.Name FROM CronTrigger
                WHERE CronJobDetail.Name = 'Schedule job to send reminder email'
                limit 1
            ];
            for (CronTrigger CronTriggerAllScheduledJobs: listCronTriggerAllScheduledJobs) {
                if ((CronTriggerAllScheduledJobs.CronJobDetail.Name).equalsIgnoreCase('Schedule job to send reminder email')) {
                    // Delete the Scheduled Job
                    System.abortJob(CronTriggerAllScheduledJobs.id);
                    break;
                }
            }
        }
        Catch(Exception e) {
            SendFailureEmail('unInstallation', e, '');
        }
    }
    //Notify CertXchange Team, in case of installation and uninstallation 
    public void SendFailureEmail(String strContex, Exception e, String str) {

        Organization orgDetail = [select Id, IsSandbox, InstanceName, Organizationtype from Organization LIMIT 1];
        String strError;
        strError = e.getMessage();
        List < String > toAddresses = new List < String > ();
        //False Positive 
        //We using the hardcoded Email Id for sending the email alert when the package installtion got failed.
        toAddresses.add('Shilpa.kamble@gmail.com');
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(toAddresses);
        mail.setReplyTo(UserInfo.getUserEmail());
        mail.setTargetObjectId(UserInfo.getUserId());
        mail.setSaveAsActivity(false);
        system.debug('mail=' + mail);
        string orgId = '';
        if (orgDetail != null)
            orgId += orgDetail.Id;
        mail.setSenderDisplayName('My Package Errors');
        if (strContex == 'unInstallation') {
            //  mail.setSubject('Exception while unInstalling package for org: ' + orgId );
            mail.setPlainTextBody('Exception : ' + strError + ' test msg =' + str);
        } else if (strContex == 'Installation') {
            //  mail.setSubject('Post install script fail for org: ' + orgId);
            mail.setPlainTextBody('Exception : ' + strError + ' test msg =' + str);
        }

        Messaging.sendEmail(new Messaging.Email[] {
            mail
        });
    }
  
}

Thanks in advance!
Hi, I have a javascript button on which i am calling a VF page. The name of the VF page is 'MyPage'. However, on the click of the javascript button, i want the VF page in the URL be displayed as "MyFirstVFPage".
Can anyone help me on this, please?
Hi

am populatig the value from the wrapper class list ito the column in pageblock table. It works perfectly if the comment field !SD.syscomment has less characters. 

The table is breaking and causig mis-alignment in the div if the comment has long values. Below is the code. please advise how to break the long comments into multiple lines within the outputtext
 
<div id="syshoverPanel" style="width: 300px;height: auto;position: fixed;background-color: #FFFFFF;overflow-y: auto;border: 1px solid #C8C8C8;border-radius: 2px;z-index:9999;display:none;">
                                                                <apex:outputpanel >
                                                                <apex:pageblock id="sysdetailpb">
                                                                    
                                                                        <apex:pageblocktable value="{!SystemDetails}" var="SD" style="color:#555;">
                                                                            <apex:column Style="text-align:right;">
                                                                                <apex:outputText value="{!SD.sysNumber}:"></apex:outputText><br/>
                                                                                <apex:outputtext value="Comments:" style="font-weight:bold"> </apex:outputtext><br/>
                                                                                <apex:outputText value="Entitlement Number:" style="font-weight:bold"> </apex:outputText><br/>
                                                                                <apex:outputText value="Manufacturer:" style="font-weight:bold"></apex:outputText><br/>
                                                                                <apex:outputText value="Manufacturer Ref:" style="font-weight:bold"></apex:outputText><br/>
                                                                                <apex:outputText value="Reseller:" style="font-weight:bold"></apex:outputText><br/>
                                                                                <apex:outputText value="MSP:" style="font-weight:bold"></apex:outputText><br/>
                                                                                <apex:outputText value="L1 Support Provider:" style="font-weight:bold"></apex:outputText>
                                                                            </apex:column>
                                                                             <apex:column >
                                                                                <apex:outputText value="{!SD.sysAccName}"></apex:outputtext><br/>
                                                                                <apex:outputText value="{!SD.syscomment}"> </apex:outputText><br/>
                                                                                <apex:outputText value="{!SD.sysEntId}"> </apex:outputText><br/>
                                                                                <apex:outputText value="{!SD.sysMFG}"> </apex:outputText><br/>
                                                                                <apex:outputText value="{!SD.sysMFGRef}"> </apex:outputText><br/>
                                                                                <apex:outputText value="{!SD.sysreseller}"> </apex:outputText><br/>
                                                                                <apex:outputText value="{!SD.MSP}"> </apex:outputText><br/>
                                                                                <apex:outputText value="{!SD.sysSuppBy}"> </apex:outputText><br/>
                                                                              </apex:column>   
                                                                        </apex:pageblocktable>
                                                                        
                                                                    </apex:pageblock>

 
Hi all,

My component code:-
<aura:set attribute="auraPreInitBlock">
    <auraStorage:init debugLoggingEnabled="true"
                         name="actions"
                         persistent="false" secure="true"
                         clearStorageOnInit="true"
                         defaultExpiration="3600"
                         maxSize="10485760" version="1.0"/>
    </aura:set> 

On the client side controller :-
doInit:function(cmp, evt, helper){
// Get server-side action
var action = cmp.get("c.fetchDataRecord");
action.setCallback(cmp, function(response){
var returnValue = response.getReturnValue();
});
// Set server-side action as storable
action.setStorable();
// Run server-side action
$A.enqueueAction(action);
},

I played with  all attribute maxsize, defaultExpiration but nothing is working out.
If anybody has came across same senario please help.

Many thanks in Advance!!