• arpit vijayvergiya
  • NEWBIE
  • 119 Points
  • Member since 2017
  • arpit vijayvergiya

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 45
    Replies

How to hide Approve and Reject button of approval process for particular profile?

It should only show to assigned approvar only.

Hi all,

I have created a VF page with a form that allow users to create a record in Salesforce, it 100% working but I've received couple of feedbacks from my users that the form is too long.

To make it short I need to divide the form into different pages but what I wanted to know is if its possible for me to use pagination on the form. 

Any ideas are welcome on how to make a form short without having to create multiple Visualforce pages as I am not sure how would that work without losing the values inputted from the previous page.

Thank you!

Hi All,
I have a visualforce page, In which I am using section header. tabstyle is also applied on page.

<apex:sectionHeader title="xyz" subtitle="{!theRecord.Name}"/>
It shows the icon according to tabstyle in classic but when I see page in Ligtning Experience icon is not visible there.

Thanks,
Arpit vijayvergiya

 
Hi all,

I cretaed a simple vf page. But when I preview it in lightning experience then, header is not visible. Available for Lightning Experience, Lightning Communities, and the mobile app is checked.

Here is code of page.
 
<apex:page standardStylesheets="true" doctype="html-5.0" showheader="false">
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
</apex:page>
Thanks,
Arpit vijayvergiya
Hi all,

I am working on a requirement on which we are generating an ms word page using contentType="application/msword#file.doc".
We are displaying an image using <img> tag. when we open the file in windows, the image is being displayed in its original size. But when we open that file in mac, then the image is being displayed in very small size.
If anyone knows the reason or solution for it. Please let me know.

Thanks,
Arpit vijayvergiya
User-added image
i want to transfer data from available list to selected list while clicking on add and remove button and also change the position by up down.. 

anyone can help plg...
thanx in advance
) Query all contact records (limit 1000), and show using jquery table as below example:
http://datatables.net/examples/basic_init/themes.html

2) Make first name as clickable, and on click show the record information in editable format in a jquery popup dialog box like below example:
http://jqueryui.com/dialog/#modal-form

3) Contact must be saved using this dialog along with Photo Upload option. That photo must be saved in attachment for that contact and must be visible when the dialog box open for that record.

in this scenario i have done upto 2nd point and in 3rd point photo is being uploaded successfully bt i am not able to show photo in popup box when i open it again after photo upload
First Namearpitvikash 
Last Namevijaykumar 
Emailabc@gmail.comabc1@gmail.com 
Phone34543543534435454 
Citynoidadelhi 
    
    
  • We have standard "Contact" object in SFDC.
  • You have to add one Field in Contact Object that is "Total Family Members" type is Number(2,0):
  • Let Account be the Family. So if there are 5 Contacts belongs to same account, that means these all 5 belongs to same family.
What you have to do:                 
  • Create a trigger on Contact to calculate "Family Members Count".
    • Create one Account: Create New Contact as a child for it. Then Contact's "Total Family Member" will have value 1.
    • Create another Contact for the same Account then Both Contact should have value 2 for "Total Family Member Field".
    • if someone changes contact's family like : changing account lookup value for a contact, then Both family will reflect. Because one family member is removed from one family and added to new Family. values should be updated: 
      •  All Contact's of Older Family should now have the "Total Family Member" value decreased by1. 
      • And for new family all Contact's "Total Family Member" will have value increased by1. 

How to hide Approve and Reject button of approval process for particular profile?

It should only show to assigned approvar only.

Please help me to cover Schedule Class in Test Class. Help me to achieve 100% code coverage.

Schedule Class:

global class ScheduleContactDelete implements Schedulable {
    
  
    global void execute (SchedulableContext ctx)
    {
        
        // Delete Contact
        List<Contact> con = [SELECT LastName FROM Contact WHERE Id IN (SELECT Contact__c FROM GDPR_Permission__c 
                                                                       WHERE Retention_Expiration_Date__c  = :Date.Today() AND Communication_Rule_Active__c = TRUE)];
        delete con;
        system.debug('Deleted Contacts :'+ con);
        
        // Delete Contact Mail Send
        
        List<Contact> con1 = [SELECT Id, Email  FROM Contact WHERE Id IN (SELECT Contact__c FROM GDPR_Permission__c 
                                                                          WHERE Retention_Expiration_Date__c  = :Date.Today())]; 
        
     //   List<Id> lstid = new List<Id>();
        for(Contact c : con1)
        {
         //   lstid.add(c.id);
            
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();                   
            mail.setToAddresses(new String[] {c.Email}); 
            mail.setSubject('Consent Data Expired' ); 
            mail.setUseSignature(false);
            mail.setHtmlBody('Dear '+c.FirstName+', <br>Your Consent Data has been deleted permanently from our System.<br>Reason: Consent for Communication has been expired. <br><br>Thank you! <br>Confident Governance Team'); 
            // Send the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });  
            
            
        }
        
        // Consent Mail
        List<Contact> con2 = [SELECT LastName FROM Contact WHERE Id IN (SELECT Contact__c FROM GDPR_Permission__c 
                                                                        WHERE Retention_Expiration_Date__c  = :Date.Today() AND Communication_Rule_Active__c = FALSE)];
      //  List<Id> Con2ID = new List<Id>();
        for(Contact c1 : con2)
        {
       //     Con2ID.add(c1.id);
            
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();                   
            mail.setToAddresses(new String[] {c1.Email}); 
            mail.setSubject('Keep Consent Details' ); 
            mail.setUseSignature(false);
            mail.setHtmlBody('Dear '+c1.FirstName+', <br><br>Communication has been stopped but we are keeping your consent details because your details are connected with our product.<br>Reason: For Legal purpose. <br>Notice: Please Contact us for future communication. <br><br>Thank you! <br>Confident Governance Team'); 
            // Send the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });  
            
            
        }
    }
    
    
}

Test Class:
 
@isTest
private class scheduleContactDeleteTest {
    
    public static string cronExp = '0 0 0 28 2 ? 2022';
    
    static testmethod void deleteExecute(){
        
        ScheduleContactDelete ss =new ScheduleContactDelete();
        
        test.startTest();
        String jobId = System.schedule('Student Information', cronExp , new ScheduleContactDelete());        
       
        contact c= new contact();
        c.Email='test@test.com';
        c.LastName='test';
        insert c;
        
        test.stopTest();
    }
}

Thanks,
Krutarth Soni.
 
 I have a requirement where Sales rep should not be able to edit Amount field of one month's old records. How to achieve this? also if he wants to change the amount field, that different amount should be added to his next month's revenue goal amount field.
i want to write test class for my class where i inserted big object, i tried to give test data for big object but its showing like un supported external object.so how to resolve this,please give sample code.
Hi All,
I have a visualforce page, In which I am using section header. tabstyle is also applied on page.

<apex:sectionHeader title="xyz" subtitle="{!theRecord.Name}"/>
It shows the icon according to tabstyle in classic but when I see page in Ligtning Experience icon is not visible there.

Thanks,
Arpit vijayvergiya

 
Hi all,

I cretaed a simple vf page. But when I preview it in lightning experience then, header is not visible. Available for Lightning Experience, Lightning Communities, and the mobile app is checked.

Here is code of page.
 
<apex:page standardStylesheets="true" doctype="html-5.0" showheader="false">
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
</apex:page>
Thanks,
Arpit vijayvergiya
I need to update a field on zone called total sales which display the total sales on agent object in that region

 
public class TotalSales {
    
     public TotalSales(){
         
         for(zone__c z : [SELECT Id,Total_Sales__C FROM Zone__C WHERE Name__c = 'North']){
             
             z.Total_Sales__C = [SELECT Sum() FROM Agent__C WHERE Total_Sales__c ='0' ];
            
            upsert z;

}
     }
}


 
Hi SF Coder,

     I have a custom Object named Tracker which has a master detail relationship with Case Object. I am trying to insert the deatil record using Lightnign:recordEditForm, but getting an unknown error: 
An error occurred while trying to update the record. Please try again.

Code Snippet:
Note: No field on tracker Object is mandatory. Also this issue is observed only in case of master detail. Once I change the field type to lookup it inserts the record.
Getting following JS error :

TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.remoteFunction (<anonymous>:2:14)


<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
    <lightning:recordEditForm objectApiName="Tracker__c">
        <lightning:messages />
        <lightning:inputField fieldName="Episode__c" />   /* Case is renamed to Episode */
        <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update" />
    </lightning:recordEditForm>
</aura:component>

Thanks,
Ankita
<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId" controller="MassReassignOpportunitiesController" access="global">
    
    
    <aura:attribute name="listOfOpportunities" type="List"/>
    
    <aura:attribute name="isExpanded" type="Boolean"/>
    
    <aura:attribute name="isExpandedPesq" type="Boolean" />
    
    <aura:attribute name="lstTiposOpp" type="List"/>
    
    <aura:attribute name="lstTiposStage" type="List"/>
    
    <aura:attribute name="searchRecord" type="String"/>
    
    <aura:attribute name="lUser" type="User"/>
    
    <aura:attribute name="recordId" type="Id"/>
    
    <aura:attribute name="mapSearch" type="map" default="{}" />
    
    <aura:attribute name="opportunity" type="Opportunity" 
               default="{ 'sobjectType': 'Opportunity' }"/>
    
       
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
   
    
    
    
    
    <div class="slds-grid slds-wrap">
        <div class="slds-col slds-size_12-of-12">
            <div class="slds-page-header">
                <div class="slds-media">
                    <div class="slds-media__figure">
                        <span class="slds-icon_container slds-icon-standard-opportunity" title="Description of icon when needed">
                            <lightning:icon iconName="custom:custom18" size="xx-small" alternativeText="Indicates approval"/>
                        </span>
                    </div>
                    <div class="slds-media__body">
                        <h1 class="slds-page-header__title slds-truncate slds-align-middle" title="Gestão de Mudança da Oportunidades">Gestão de mudança da oportunidades</h1>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <br/>
    
  	<lightning:recordEditForm aura:id="recordViewForm"
                          	  recordId="{!v.recordId}"
                              objectApiName="Opportunity">
    <div class="slds-page-header" style="background-color:#f4f6fe;">

        <div class="slds-grid slds-wrap">
            <div class="slds-col slds-size_12-of-12">
                <div class="slds-box" style="background-color:#007add;">
                    <div class="demo-only demo-only--sizing slds-grid slds-wrap">
                        <div class="slds-size_12-of-12">
                            <h4 class="slds-text-title_caps" id="treeheading" style="color:#fff;">Pesquisar Oportunidades</h4>
                        </div>
                    </div>
                </div>           
                <ul class="slds-tree" role="tree" aria-labelledby="treeheading">
                    <li role="treeitem" aria-level="1" aria-expanded="{!v.isExpanded}" aria-label="Tree Branch">
                        <br></br>
                        <div class="slds-tree__item slds-is-selected">
                            <button class="slds-button slds-button_icon slds-button_icon slds-m-right_x-small" aria-hidden="{!v.isExpanded}" onclick="{!c.changeState}" tabindex="-1" title="Expand Tree Branch">
                                <lightning:icon iconName="utility:chevronright" size="xx-small" alternativeText="Indicates approval"/>
                                <span class="slds-assistive-text">Pesquisa com Lista</span>
                            </button>
                            <span class="slds-size_1-of-1">
                                <span class="slds-tree__item-label slds-truncate" title="Pesquisa com Lista">Pesquisa com Lista</span>
                            </span>
                        </div>
                        <ul role="group">
                            <li role="treeitem" aria-level="2" aria-selected="false">
                                <div class="demo-only demo-only--sizing slds-grid slds-wrap">
                                    <div class="slds-size_3-of-12">
                                        <lightning:select name="selectItem" label="Lista" onchange="{!c.selectOpp}">
                                            <aura:iteration items="{!v.lstTiposOpp}" var="lstOpp"> 
                                                <option value="{!lstOpp}">{!lstOpp}</option>
                                            </aura:iteration>
                                        </lightning:select>
                                    </div>
                                </div>
                            </li>
                            <a href="/lightning/o/Opportunity/list?filterName=Recent"   target="_new" >Criar novo modo de exibição</a>
                        </ul>
                    </li>
                </ul>
            </div>
            
            <br></br>

            <div class="slds-col slds-size_12-of-12">
                <ul class="slds-tree" role="tree" aria-labelledby="treeheading">
                    <li role="treeitem" aria-level="1" aria-expanded="{!v.isExpandedPesq}" aria-label="Tree Branch">

                        <div class="slds-tree__item slds-is-selected">
                            <button class="slds-button slds-button_icon slds-button_icon slds-m-right_x-small" aria-hidden="{!v.isExpandedPesq}" onclick="{!c.changeStateTwo}" tabindex="-1" title="Pesquisar Oportunidades">
                                <lightning:icon iconName="utility:chevronright" size="xx-small" alternativeText="Indicates approval"/>
                                <span class="slds-assistive-text">Pesquisa com um critério de busca</span>
                            </button>
                            <span class="slds-size_1-of-1">
                                <span class="slds-tree__item-label slds-truncate" title="Pesquisa com um critério de busca">Pesquisa com um critério de busca</span>
                            </span>
                        </div> 
                         
                        <ul role="group">
                            <li role="treeitem" aria-level="2">
                                <div class="demo-only">
                                    <div class="slds-form slds-form_compound">
                                        <div class="slds-col slds-size_8-of-12">
                                            <fieldset class="slds-form-element">
                                                <div class="slds-form-element__group">
                                                    <div class="slds-form-element__row">                                                        
                                                        <div class="slds-form-element slds-size_1-of-2">
                                                            <lightning:inputField fieldName="Name"/>                                         
                                                        </div>
                                                        <div class="slds-p-horizontal--xx-large"></div>                    
                                                       <div class="slds-form-element slds-size_1-of-2">            
                                                         <lightning:inputField fieldName="StageName" />   
                                                    </div>
                                                  </div>                                         
                                                </div>            
                                            </fieldset>
                                                
                                        </div>
                                        <div class="slds-col slds-size_8-of-12">
                                            <fieldset class="slds-form-element">
                                                <div class="slds-form-element__row">
                                                    <div class="slds-form-element slds-size_1-of-2">
                                                         <lightning:inputField fieldName="AccountId" />   
                                                    </div>
                                                    <div class="slds-p-horizontal--xx-large"></div> 
                                                    <div class="slds-form-element slds-size_1-of-2">
                                                         <lightning:inputField fieldName="OwnerId" />   
                                                    </div>
                                                    </div>
                                                  
                                            </fieldset>
                                        </div> 
                                        
                                        
                                        <div class="slds-col slds-size_8-of-12">
                                            <fieldset class="slds-form-element">
                                                <div class="slds-form-element__row">
                                                    <div class="slds-form-element slds-size_1-of-2">
                                                        <label class="slds-form-element__label" for="input-01">CNPJ/CPF</label>
                                                        <input type="text" id="input-01" value="{!v.opportunity.BI_BR_CNPJ_CPF__c}" class="slds-input" />
                                                    </div>
                                                    <div class="slds-p-horizontal--xx-large"></div>
                                                    <div class="slds-form-element slds-size_1-of-2">
                                                        <label class="slds-form-element__label" for="input-01">Número da Oportunidade</label>
                                                        <input type="text" id="input-01" value="{!v.opportunity.BI_BR_Identificador__c}" class="slds-input" />
                                                    </div>
                                                    
                                                </div>
                                            </fieldset>
                                        </div>
                                        <div class="slds-col slds-size_8-of-12">
                                            <fieldset class="slds-form-element">
                                                <div class="slds-form-element__row">
                                                    <div class="slds-form-element slds-size_1-of-2">
                                                        <legend class="slds-form-element__label slds-text-title_caps">Data de Criação</legend>
                                                        <label class="slds-form-element__label" for="input-01">A partir de</label>
                                                        <input type="date"  id="input-01" class="slds-input" value="{!v.opportunity.From__c}" />
                                                        <label class="slds-form-element__label" for="input-01">Até</label>
                                                        <input type="date"  id="input-01" class="slds-input" value="{!v.opportunity.To__c}" />

                                                    </div>
                                                    <div class="slds-p-horizontal--xx-large"></div>
                                                    <div class="slds-form-element slds-size_1-of-2">
                                                        <legend class="slds-form-element__label slds-text-title_caps">Data de fechamento estimado</legend>
                                                        <label class="slds-form-element__label" for="input-01">A partir de</label>
                                                        <input type="date" id="input-01" class="slds-input" value="{!v.opportunity.ClosedDate_From__c}" />
                                                        <label class="slds-form-element__label" for="input-01">Até</label>
                                                        <input type="date"  id="input-01" class="slds-input" value="{!v.opportunity.ClosedDate_To__c}"/>

                                                    </div>
                                                </div>
                                            </fieldset>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </li> 
                </ul>
            </div>
        </div>
    </div>
 </lightning:recordEditForm>

 
Hi all,
Scenaio : How to pass values from one VF page to another VF page.
I have 2 VF pages.   emp VF page and DetailVFpage
i have values firstname, lastname,email, phone in empVFPage and need to pass values to DetailVFpage.

 PageReference pageRef= new PageReference('/apex/DetailVFpage');

i can able to naviage to 2nd VF page(DetailVFPage) after click on link in empVFPage....But values are not passing
1stVFpage
when click on Verification page link, i can able to see Detail VF page..But the values not passing ..
see screenshot the Result page not showing values of VF page firstname, lastname....
2ndVFPage
Anyone have idea on htis
 
  • April 30, 2018
  • Like
  • 0
Example :

Probability (%) =15%
Then due date should be = due date+15%

My Trigger :
trigger createTask on Opportunity (after insert, after update) {
List<Task> Tasks = new List<Task>();
  if(Trigger.isInsert && Trigger.isAfter){
  for(Opportunity o: Trigger.New){
    Task ts=new Task(subject='stage1',ActivityDate= o.CloseDate-120, WhatId= o.id);
    tasks.add(ts); 
    Task ts1=new Task(subject='stage2',ActivityDate= o.CloseDate-90, WhatId= o.id); 
    tasks.add(ts1); 
    Task ts2=new Task(subject='stage3',ActivityDate= o.CloseDate-80, WhatId= o.id);
    tasks.add(ts2); 
    }
    insert Tasks;
    }
    
if(Trigger.isUpdate && Trigger.isAfter){
system.debug('********');        
for(Opportunity o: Trigger.New){
List<Task> latestRecords = [SELECT Id,Subject,WhatId,ownerId,Status FROM Task WHERE WhatId =: o.Id];
    
system.debug('Tasks:'+latestRecords);
  for(Task t: latestRecords){
  if(o.StageName == '2'){
  if(t.subject == 'stage1'){
  t.Status = 'Completed';
  }
  }
  if(o.StageName == '3'){
  if(t.subject == 'stage2'){
  t.Status = 'Completed';
  }
  }
  if(o.StageName == 'Closed Lost'){
  if(t.subject == 'stage3'){
  t.Status = 'Completed';
  }
  } 
  }
  update latestRecords;
  }
  }
}
  • April 30, 2018
  • Like
  • 0
Hi,

The lightning:recordEditForm doc mentions that the onsuccess action returns the following parameter.

response - Object[]
The response data associated with the record during a record create or edit.
apiName: The record’s API name, such as Contact.
childRelationships: The child relationship data for this record.
fields: The field data for this record, matching the requested layout.
id: The ID of this record.
recordTypeInfo: The record type info for this record, if any.

Can anybody please tell me where i get that reponse and how to use it.
Not sure where this is erroring out.

trigger MSAData on Account (before insert,before update) { 
    for (account Acc:trigger.new){       
               
Map<String,String> MSALookup = new Map<String,String>();
  Set<String> AZipCode = new Set<String>();  
  
        
if(trigger.IsInsert){
 for(Account A:Trigger.new) {
    AZipCode.add(A.billingpostalcode);
  for(naics_code__c NA:
    [SELECT      zip_code__c, msa_code__c
     FROM        naics_code__c
     WHERE       zip_code__c IN :AZipCode]) {

    MSALookup.put(NA.zip_code__c,NA.msa_code__c);
  }
 }

  for(Account A:Trigger.new) {
      if(MSALookup.containsKey(A.billingpostalcode)) {
      A.d_B_msa_code__c = MSALookup.get(A.billingpostalcode);
      }
  }
    
    for(Account A:Trigger.new) {    
    AZipCode.add(A.billingpostalcode);
        
 for(naics_code__c NA:
    [SELECT      zip_code__c, msa_name__c
     FROM        naics_code__c
     WHERE       zip_code__c IN :AZipCode]) {

    MSALookup.put(NA.zip_code__c,NA.msa_name__c);
  }
 }

  for(Account A:Trigger.new) {
      if(MSALookup.containsKey(A.billingpostalcode)) {
      A.d_B_msa_description__c = MSALookup.get(A.billingpostalcode);
      }
  }
}
else                    

    
if(trigger.isUpdate){    

    for(Account acct:trigger.new){
        account oldAcct= Trigger.oldmap.get(Acct.Id);
    if (oldacct.BillingPostalCode<>Acct.BillingPostalCode){
    
    for(Account A:Trigger.new) {
        
       
           
    AZipCode.add(A.billingpostalcode);
       
 for(naics_code__c NA:
    [SELECT      zip_code__c, msa_name__c
     FROM        naics_code__c
     WHERE       zip_code__c IN :AZipCode]) {

    MSALookup.put(NA.zip_code__c,NA.msa_name__c);
  }
    }
    
  for(Account A:Trigger.new) {
      if(MSALookup.containsKey(A.billingpostalcode)) {
      A.d_B_msa_description__c = MSALookup.get(A.billingpostalcode);
      }
  }
    for(Account A:Trigger.new) {
        
    AZipCode.add(A.billingpostalcode);
  for(naics_code__c NA:
    [SELECT      zip_code__c, msa_code__c
     FROM        naics_code__c
     WHERE       zip_code__c IN :AZipCode]) {

    MSALookup.put(NA.zip_code__c,NA.msa_code__c);
  }
 }

  for(Account A:Trigger.new) {
      if(MSALookup.containsKey(A.billingpostalcode)) {
      A.d_B_msa_code__c = MSALookup.get(A.billingpostalcode);
      }
  }
}
}
}
}
}
How to exclude an user from a validation rule?