• Santosh Kumar 348
  • SMARTIE
  • 789 Points
  • Member since 2016

  • Chatter
    Feed
  • 26
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 92
    Replies
I need a red bar to appear when the following conditions are met on the record:
IF a checkbox value is true
OR
IF a date field is within 14 days of today AND a status field is a certain value.

This is what I have tried but the OR is giving me a syntax error.

IF(Checkbox = TRUE, IMAGE("/img/samples/color_red.gif ","red", 15,120),"blank")
OR(
IF( Date__c - TODAY() < 14,
IF(AND(ISPICKVAL( Status__c ,"Committed by client")),IMAGE("/img/samples/color_red.gif ","red", 15,120),"blank"))
Hi,
I have 2 Visualforce pages that I would like to share the 1 controller. The first page which is already connected to the controller is a list, and the second page is a registration form. How would I add the registration form to the controller?
Thank you

Page 1:
<apex:page controller="NFOSController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Availability__c}"/>
                <apex:column value="{!a.Number_of_Competitors__c}"/>
                <apex:column value="{!a.Active__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
public class NFOSController {

    public List<Division_Space2__c> accs {
        get {
            if (accs == null) accs = [select name, Availability__c, Number_of_Competitors__c, Active__c from Division_Space2__c limit 1000];
            return accs;
        }
        set;
    }
}
​​​​​​​
Page 2:
<apex:page standardController="Competitor2__c" lightningStylesheets="true">
<apex:sectionHeader title="Noosa Festival of Surfing" />
       <apex:form id="NFOS1"> 
        
    <apex:pageBlock title="New Competitor" mode="edit">
             <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
             </apex:pageBlockButtons>
                        
            <apex:pageBlockSection columns="2" showHeader="true" title="Registration" >
                <apex:inputField value="{!Competitor2__c.Name}" required="false"/>
                <apex:inputField value="{!Competitor2__c.First_Name__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Division_Space__c}" required="true"/>
                <apex:inputField value="{!Competitor2__c.Lastname__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Date_of_Birth__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Waiver_Read_T_Cs_Accepted__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Email_Address__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Phone_Number__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Street_Address__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Suburb__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.State__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Postcode__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Country__c}" required="false"/>
                <apex:pageBlockSectionItem />
            </apex:pageBlockSection>            
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
Hi there,
I’m looking to create a validation rule on a Geolocation field (longitude and latitude fields).
I want to ensure that the Sales reps are entering values that have a MINIMUM of 6 digits after the decimal place. How would I do this? I was thinking of creating a validation rule. But I’m not sure how to create the logic.
For example:
11.123456 (acceptable)
11.12345 (not acceptable)
Field Name: Coordinates __c
Thank you for your help!
Can someone help with Test class for below.

Thanks in Advance
 
@RestResource(urlMapping='/referrallead/*')
global with sharing class ReferalProgram {
   
    @HttpGet
    global static lead getLeadById() {
        //  global static opportunity getOpportunityById() {
        RestRequest request = RestContext.request;
        String leadId = request.requestURI.substring(request.requestURI.lastIndexOf('/')+1);
        
        lead result =  [SELECT lastname,firstname,email,Phone,status FROM lead WHERE Id = :leadId]; 
        return result;
    }
    
    @HttpPost
    global static ID createlead(String firstname, String lastname,String email, String phone, String company, String leadsource, String origin, String reffname, String reflname,String rectype) {
        
        lead thislead = new lead();
        List<Lead> leadlist = [select id,lastname,email from lead where email =: email];
        contact thiscontact = new contact();
        List<Contact> conList = [select id,name,email from Contact where email =: email];
        if(leadlist.size() >0 || conList.size() >0){
            thislead.Email.addError('Email already exists');
        }
        else
        thislead.Lastname = lastname;
        thislead.Firstname = firstname;
        thislead.Email = email;
        thislead.Company = company;
        thislead.phone = phone;
        thislead.leadsource = leadsource;
        thislead.origin__c = origin;
        thislead.Referrer_First_Name__c = reffname;
        thislead.Referrer_Last_Name__c = reflname;
        thislead.RecordTypeId = '012D00000007Q8D';
        insert thislead;
        return thislead.Id;
    }

    @HttpPatch
    global static ID updateleadFields() {
        RestRequest request = RestContext.request;
        String leadId = request.requestURI.substring(
            request.requestURI.lastIndexOf('/')+1);
        lead thislead = [SELECT Id FROM lead WHERE Id = :leadId];
        // Deserialize the JSON string into name-value pairs
        Map<String, Object> params = (Map<String, Object>)JSON.deserializeUntyped(request.requestbody.tostring());
        // Iterate through each parameter field and value
        for(String fieldName : params.keySet()) {
            // Set the field and value on the Lead sObject
            thislead.put(fieldName, params.get(fieldName));
        }
        update thislead;
        return thislead.Id;
    }    
}

 
Hello Folks,

I can't post record from workbench. 
Recieving below error message:
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [LastName]: [LastName] Class.ReferalProgram.createlead: line 35, column 1

Appreaciate any help can provide.
@RestResource(urlMapping='/referrallead/*')
global with sharing class ReferalProgram {
   
    @HttpGet
    global static lead getLeadById() {
        //  global static opportunity getOpportunityById() {
        RestRequest request = RestContext.request;
        String leadId = request.requestURI.substring(request.requestURI.lastIndexOf('/')+1);
        
        lead result =  [SELECT lastname,firstname,email,Phone,status FROM lead WHERE Id = :leadId]; 
        return result;
    }
    
    @HttpPost
    global static ID createlead(String firstname, String lastname,String email, String phone, String company, String leadsource, String origin, String reffname, String reflname,String rectype) {
        
        lead thislead = new lead();
        List<Lead> leadlist = [select id,lastname,email from lead where email =: email];
        contact thiscontact = new contact();
        List<Contact> conList = [select id,name,email from Contact where email =: email];
        if(leadlist.size() >0 || conList.size() >0){
            thislead.Email.addError('Email already exists');
        }
        else
        thislead.Lastname = lastname;
        thislead.Firstname = firstname;
        thislead.Email = email;
        thislead.Company = company;
        thislead.phone = phone;
        thislead.leadsource = leadsource;
        thislead.origin__c = origin;
        thislead.Referrer_First_Name__c = reffname;
        thislead.Referrer_Last_Name__c = reflname;
        thislead.RecordTypeId = '012D00000007Q8D';
        insert thislead;
        return thislead.Id;
    }

    @HttpPatch
    global static ID updateleadFields() {
        RestRequest request = RestContext.request;
        String leadId = request.requestURI.substring(
            request.requestURI.lastIndexOf('/')+1);
        lead thislead = [SELECT Id FROM lead WHERE Id = :leadId];
        // Deserialize the JSON string into name-value pairs
        Map<String, Object> params = (Map<String, Object>)JSON.deserializeUntyped(request.requestbody.tostring());
        // Iterate through each parameter field and value
        for(String fieldName : params.keySet()) {
            // Set the field and value on the Lead sObject
            thislead.put(fieldName, params.get(fieldName));
        }
        update thislead;
        return thislead.Id;
    }    
}

 
The developer console on our partial copy instance doesn't seem to load. I am able to login into Salesforce and navigate through the screens. Its just the developer console, that's hanging. Any help to get around this, will be much appreciated.

User-added image
How to delete a target property from config elements from lwc.

for exx:
 <targetConfigs>
        <targetConfig targets="lightningCommunity__Default">
            <property name="recordId" type="String" label="Record ID" default="{!recordId}"  description="The value should be {!recordId}."/>
         <property name="objectApiName" type="String" label="Object Name" description="Automatically bind the page's object name to the component variable"
            default="{!objectApiName}" />
        </targetConfig>
    </targetConfigs>

i want to delete property objectApiName but when i remove code or delete from community page and publish that then also it return me errot that i can delete a config property,
I am in the process of developing an apex:form that will save two records: Recipient__c and Scholarship_Award__c. 

I need to create a custom controller to save new records for both objects on the same VF page. 
The trouble is the Recipient__c record will need to be saved first following the insertion of Scholarship_Award__c because it references Recipient__c as the parent in a master-detail relationship. 

Ideally, the end-user will input the fields of recipient__c, and scholarship_award__c and two records will be saved: a new recipient, and a new scholarship with that recipient as the parent. 

How can I go about developing this?
Hello,
I am having an issue where I am adding a quickaction to create a child record but the record type selector is not popping up.  The Action is a lightning component.  profile has access to record type.  Was working before I added componet.
Thanks,
Hi,

On my case record in community, I want to prevent the user from updating the case by editing the Status field. The user should be able to close the case with the click of a custom button

Appreciate if anyone can provide their ideas
 
I am overriding a new button on a custom object with an  aura component(LWC wrapped inside Aura).  How do I get the record Type  that the user has selected and pass it to the LWC?  The reason I need this is that the picklist values are based on the record type.
 
Thanks
P
picklist_example cmp
<aura:component >
    <aura:attribute name="selected" type="string" default="1"/>
    <lightning:select name="select1" label="How many tickets" value="{!v.selected}"  onchange="{!c.show}">
        <option value="">choose one..</option>
        <option value="1">one</option>
        <option value="2">two</option>
        <option value="3">three</option>
        
    </lightning:select>
    <br/><br/>
    
    <aura:attribute name="options" type="list" default="[{'label':'java','value':'ocjp'}
                                                        {'label':'sfdc','value':'admin'}
                                                        {'label':'aws','value':'aws01'}]"/>
    <aura:attribute name="value" type="list" default="option1"/>
    
           <lightning:checkboxGroup name="Checkbox Group"
                                 label="certifications"
                                 options="{!v.options}"
                                 value="{!v.value}"
                                 onchange="{!c.handleChange}"/>
    
</aura:component>

controller
({
    show : function(component, event, helper) {
        var result=event.getParam('value');
        alert(result);
        
    },
    handleChange: function (component, event) {
        alert(event.getParam('value'));
    }
})
Application
<aura:application extends="force.slds" >
    <c:picklist_example/>
    
</aura:application>
Hi ,

below code getting Error State while saving the record so i couldn't navigate to recently created record page.
 
getSave : function (component, event, helper) {
        alert('Current Record Id |' + component.get("v.recordId"));
        var action = component.get("c.GD_newQuoteVersion");
        var toastEvent = $A.get("e.force:showToast");
        action.setParams({
            //"quote":component.get("v.quote"),
            quoteId: component.get("v.recordId")
        });
        
        action.setCallback(this,function(result){
            var state = result.getState();
            alert('state ' + state);
            /*if (state == "SUCCESS") {
                var res = result.getReturnValue();
                alert('INside of success ' + res);
                component.set("v.returnId",res);
            }*/
            var newQtId = result.getReturnValue();
            console.log('Return Value is:' + JSON.stringify(result.getReturnValue()));
            alert('New Quote Id - ' + JSON.stringify(result.getReturnValue()));
            //component.set("v.returnId",data.getReturnValue());
            /*Toast Event*/
            toastEvent.setParams({
                title: "Success!",
                message: "Quote is created successfully!",
                type: "success"
            });
            toastEvent.fire();
            /*Navigation*/
            var recId = component.get("v.recordId");
            var sObectEvent = $A.get("e.force:navigateToSObject");
            sObectEvent .setParams({
                "recordId": recId,
                "slideDevName": "detail"
            });
            sObectEvent.fire();
        });
        $A.enqueueAction(action);  
    }

Can anyone please tell me where i did mistake ? 

Hearty thanks in advance.

Regards,
Soundar.
I am quite new to Force.com development, and I am struggling with an issue that I thought would be quite simple.  I have a custom VisualForce page, and I want the help text bubble icon and text to be displayed on my page, but I cannot figure out how to do that. I have read the posts on this forum for that same question and have implemented what I think is the correct approach, but it still shows nothing.  My VF code is like this:

<apex:pageBlockSectionItem HelpText="{!$ObjectType.BNTE_Build_Note__c.Fields.Work_Order_ID__c.InlineHelpText}"> 
                    <apex:outputLabel value="{!$ObjectType.BNTE_Build_Note__c.fields.Work_Order_ID__c.label}"/>
                    <apex:inputField value="{!BNTE_Build_Note__c.Work_Order_Id__c}"/> 
                 </apex:pageBlockSectionItem>

My page is set to ShowHeader = "true".

Could anybody suggest what I could try to get this to work?
Hello,

I have one field that is called "TimetoAssignSLA__c" which consists of the following formula:

IF(BMCServiceDesk__StatusChangeDate__c - BMCServiceDesk__openDateTime__c > 0 ,TEXT( FLOOR( BMCServiceDesk__StatusChangeDate__c - BMCServiceDesk__openDateTime__c ) ) & " days "& TEXT( FLOOR( MOD( (BMCServiceDesk__StatusChangeDate__c - BMCServiceDesk__openDateTime__c ) * 24, 24 ) ) ) & " hours "
& TEXT( ROUND( MOD( (BMCServiceDesk__StatusChangeDate__c - BMCServiceDesk__openDateTime__c ) * 24 * 60, 60 ), 0) ) & " minutes","")

That works exactly as I need it to and now I need to create a new field called "SLAMet" that determines if the result of "
TimetoAssignSLA__c" column is >30 minutes. If so, I want the results to say "MISSED". If <30 minutes, I want the results to say "MET". 
User-added image

Would someone be so kind to help me with the formula for the SLA Met? Please note, I will need the field type as well to ensure I set the fornula up properly. Also, is there a way if it's MISSED to make the text RED and if it's MET to make the text GREEN? If so, would you please include that in the formula as well?

Formulas aren't my strong suit and any help would be most appreciated. 

Thanks,
Sheree
I have a visualforce page located on the case object that shows a table with assets that are related to that case. From the asset table you can update the asset serial number, click the custom save button and the asset serial number updates and saves. The issue I am running into is that I added a checkbox to the asset table from the related case. When the checkbox is checked in the asset table and the save button is clicked the checkbox field on the case does not update or save. 

Here is my visualforce page code.
<apex:page standardController="Case" extensions="pullEquipmentUpdateAssetClass">     

    <p></p>
    
<!--List of Assets. Can update serial number of the asset from this table-->
    
    <apex:pageblock id="Assets"> 

         <br/> 
        
			<apex:form >
                
                <apex:pageBlockTable value="{!Assets}" var="asset">
                
                	<apex:column value="{!asset.Product_Code_Display__c}"/>
                
                	<apex:column value="{!asset.Product_Description_Display__c}"/> 
                    
                    <apex:column value="{!asset.Delivery_Address__c}"/>
                
					<apex:column value="{!asset.Serial_Number_Procurement__c}"/>
					
                    <apex:column headerValue="Serial Number"><apex:inputText value="{!asset.Serial_Number_Procurement__c}" required="true" /></apex:column>
					
                    <!-- this checkbox can be checked, but when the save button is clicked the checkbox field on the case does not update -->
                    <apex:column headerValue="Equipment has been pulled"><apex:inputCheckbox value="{!asset.Child_Fulfillment_Ticket__r.Equipment_Has_Been_Pulled__c}"/></apex:column>
                
                </apex:pageBlockTable>
               
                <apex:commandButton value="Save" action="{!saveSerialIdNumber}"/>
        
        </apex:form>
       
    </apex:pageblock>
    
</apex:page>
And here is my apex class:
public class pullEquipmentUpdateAssetClass {


    public List<Asset> Assets{get;set;}
    
    public Case Cases {get;set;} 

    public Case c {get;set;} 
    
    //Constructor 

     public pullEquipmentUpdateAssetClass(ApexPages.StandardController controller) { 

        c = (Case)controller.getRecord();      

        Cases = [SELECT id, FROM Case WHERE id=: c.id LIMIT 1]; 

        Assets = [SELECT id,Child_Fulfillment_Ticket__r.Equipment_Has_Been_Pulled__c,Serial_Number_Procurement__c,Name,Delivery_Address__c,Product_Code_Display__c,Product_Description_Display__c FROM Asset WHERE Serialized__c = true AND Child_Fulfillment_Ticket__c = :Cases.id]; 
     
     } 
  
    //save button for serial number
    
    public PageReference saveSerialIdNumber(){
        update Assets;
        Assets = [SELECT id,Child_Fulfillment_Ticket__r.Equipment_Has_Been_Pulled__c,Serial_Number_Procurement__c,Name,Delivery_Address__c,Product_Code_Display__c,Product_Description_Display__c FROM Asset WHERE Serialized__c = true AND Child_Fulfillment_Ticket__c = :Cases.id]; 
return ApexPages.currentPage();
    }
}

I am still fairly new to apex, so I am not super familiar with it 
A developer creates a customer controller and custom Visualforce page by using the following code block:
public class myController { public String myString;
public String getMyString() { return 'getMyString';
}
public String getStringMethod1() { return myString;
}
public String getStringMethod2() { if (myString == null)
myString = 'Method2'; return myString;
}
}

<apex:page controller="myController">

{!myString}, {!StringMethod1}, {!StringMethod2}, {!myString}

</apex:page>


What does the user see when accessing the custom page?

a.    getMysString, , Method2, getMyString
b.    , , Method2, getMyString
c.    , , Method2,
d.    getMyString, , ,
 
public class sampleCons {
    
    public string selectedValue {get;set;}
    public boolean isDisabled{set;get;}
    public sampleCons(ApexPages.StandardController controller){
        isDisabled=true;
    }
    public PageReference test() {
        if(selectedValue == 'True'){
        // perfom your logic here
        system.debug('====>'+selectedValue);
            isDisabled=true;
        } else if (selectedValue == 'False'){
            system.debug('====>'+selectedValue);
              isDisabled=false;
        // perform your logic here
        }
        return null;
    }
                
    public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>(); 
        options.add(new SelectOption('True','True')); 
        options.add(new SelectOption('False','False'));
        system.debug('====>'+options);
        return options; 
    }   
}
 
<apex:page standardController="Account" extensions="sampleCons">
    <apex:form id="myForm">
        <apex:pageMessages />
        <apex:selectRadio value="{!selectedValue}">
            <apex:selectOptions value="{!items}">
           
            </apex:selectOptions>
            </apex:selectRadio><p/>
        <apex:pageBlock title="Edit Contact" rendered="{!isDisabled}">
            <apex:pageBlockSection columns="1">
        <apex:inputField value="{!account.name}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
     </apex:form>
 </apex:page>

User-added image
I  am new to VF code, I have tried above code but it is not working for me. If I select true radio button then account name should be display and if I select false then it should be disabled
I need a red bar to appear when the following conditions are met on the record:
IF a checkbox value is true
OR
IF a date field is within 14 days of today AND a status field is a certain value.

This is what I have tried but the OR is giving me a syntax error.

IF(Checkbox = TRUE, IMAGE("/img/samples/color_red.gif ","red", 15,120),"blank")
OR(
IF( Date__c - TODAY() < 14,
IF(AND(ISPICKVAL( Status__c ,"Committed by client")),IMAGE("/img/samples/color_red.gif ","red", 15,120),"blank"))
public class YoutubeApi
{
public static String Nameoftheyoutubechannel(String ChannelName)
{
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://www.googleapis.com/youtube/v3');
request.setMethod('GET');
HttpResponse response = http.send(request);
if(response.getStatusCode()==200)
{
    Map<String,Object>jsonbody=(Map<String,Object>)JSON.deserializeUntyped(response.getBody());
    Map<String,Object>result=(Map<String,Object>)jsonbody.get('SNIPPET');
    String id=(String) result.get('ChannelId');

    return id;
}
else
{
    system.debug(+ response.getStatusCode() + '' +response.getStatus());
}
}
}
Hi, can anyone help me to find an answer to the following question : 

The VP of Sales at Universal Containers has requested that Sales reps be given access to view all Accounts in Salesforce. However, they’ve also requested that sales reps only be allowed to create new Opportunities on Accounts they own. How can this requirement be met?
A. Create an Opportunity Validation Rule that compares the Opportunity and Account Owners.
B. Create a new Opportunity Quick Action that validates Account ownership.
C. Set the Organization-Wide Defaults sharing on Opportunities to Private and recalculate sharing.
D. Set the Organization-Wide Defaults sharing on Opportunities to Controlled by Parent.
Some post says Answer is D, but I didn't find 'Control by parent' option for the opportunity in Sharing setting.
 
Hi Team,

I have custom window.print() button that print the data of record detail page information. when click on that button the text information is improper way. We have sections on record detail page i.e sections half text in one page another half text in another page. I want to print the information in section wise. Please help

Thank you
Ranjith



 
Hi,
I have 2 Visualforce pages that I would like to share the 1 controller. The first page which is already connected to the controller is a list, and the second page is a registration form. How would I add the registration form to the controller?
Thank you

Page 1:
<apex:page controller="NFOSController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Availability__c}"/>
                <apex:column value="{!a.Number_of_Competitors__c}"/>
                <apex:column value="{!a.Active__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
public class NFOSController {

    public List<Division_Space2__c> accs {
        get {
            if (accs == null) accs = [select name, Availability__c, Number_of_Competitors__c, Active__c from Division_Space2__c limit 1000];
            return accs;
        }
        set;
    }
}
​​​​​​​
Page 2:
<apex:page standardController="Competitor2__c" lightningStylesheets="true">
<apex:sectionHeader title="Noosa Festival of Surfing" />
       <apex:form id="NFOS1"> 
        
    <apex:pageBlock title="New Competitor" mode="edit">
             <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
             </apex:pageBlockButtons>
                        
            <apex:pageBlockSection columns="2" showHeader="true" title="Registration" >
                <apex:inputField value="{!Competitor2__c.Name}" required="false"/>
                <apex:inputField value="{!Competitor2__c.First_Name__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Division_Space__c}" required="true"/>
                <apex:inputField value="{!Competitor2__c.Lastname__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Date_of_Birth__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Waiver_Read_T_Cs_Accepted__c}" required="false"/>
                <apex:inputField value="{!Competitor2__c.Email_Address__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Phone_Number__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Street_Address__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Suburb__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.State__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Postcode__c}" required="false"/>
                <apex:pageBlockSectionItem />
                <apex:inputField value="{!Competitor2__c.Country__c}" required="false"/>
                <apex:pageBlockSectionItem />
            </apex:pageBlockSection>            
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
Hi there,
I’m looking to create a validation rule on a Geolocation field (longitude and latitude fields).
I want to ensure that the Sales reps are entering values that have a MINIMUM of 6 digits after the decimal place. How would I do this? I was thinking of creating a validation rule. But I’m not sure how to create the logic.
For example:
11.123456 (acceptable)
11.12345 (not acceptable)
Field Name: Coordinates __c
Thank you for your help!

Hello Salesforce Ohana,
Opportunity is connected with Custom Object A and Custom B.
Custom Object A and Custom Object B are only related by Opportunity (Lookup).

There is one more Custom object C.
Custom Object C is only connected to Custom object B not directly connected with Opportunity or Custom object A.

What I am trying to achieve to is When Custom Object c records are created then one of its fields I need to pass to Custom object A record.

Suppose 3 Custom object C records created so there will be already Custom object A 3 records available where I need to pass value from Custom object C.

It doesn't matter Custom Object C 1st number record data gets attached to Custom object A 3rd number but opportunity needs to be the same as values are unique.

 

Any suggestions or guidance will be helpful.

Thanks in advance
User-added image

I want complete Apex trigger on any object having before insert, after insert , before update, after update, before delete and after delete logic example and show its execution.How can i did that help me.
There is a current trigger for Property Object for new records created in Salesforce that will check the address in Zillow (API)  and then update the field Parcel ID when the address is located. However, when I use dataloader for new records bulk upload, this trigger isn't firing. I still have to manually update each Property and refresh for the trigger to fire. Can you please help me with how I can fix this to work on bulk uploads?

Here is the PropertyHandler trigger that I can see in Dev Console:

public class PropertyDetailsHandler {
    public static Integer counter;
    static {
        counter = 1;
    }
    
    public static void checkAddress(List<Property_Details__c> newList, List<Property_Details__c> oldList){
        Set<Id> udpatedList = new Set<Id>();
        for(Integer i=0; i< newList.size(); i++){
            if(newList[i].Street_Address__c != oldList[i].Street_Address__c 
               ||
               newList[i].Unit_Number__c != oldList[i].Unit_Number__c 
               ||
               newList[i].State__c != oldList[i].State__c 
               ||
               newList[i].City__c != oldList[i].City__c
               ||
               newList[i].Postal_Code__c != oldList[i].Postal_Code__c){
                   udpatedList.add(newList[i].Id);
                   updateName(newList[i]);
                       
               }
        }
        if(udpatedList.size() > 0){
            
            if(System.Label.Is_Zillow_Active == '1' || Test.isRunningTest()){
                ZillowController.updateFromZillow(udpatedList);
            }
            if(System.Label.Is_Zillow_Active == '0'){
                BridgeController.updateFromBridge(udpatedList);
            }
        }
    }
    
    public static void updateName(Property_Details__c prop){
        prop.Name = '';
        if(prop.Street_Address__c != null &&prop.Street_Address__c != ''){
            prop.Name =prop.Street_Address__c;
        }
        if(prop.Unit_Number__c  != null &&prop.Unit_Number__c != ''){
            if(prop.Name != ''){
                prop.Name += ', #' +prop.Unit_Number__c; 
            }
        }
        
        if(prop.City__c  != null && prop.City__c != ''){
            if(prop.Name != ''){
                prop.Name += ', ' + prop.City__c; 
            }
        }
        
        if(prop.State__c  != null && prop.State__c != ''){
            if(prop.Name != ''){
                prop.Name += ', ' + prop.State__c; 
            }
        }
        
        if(prop.Postal_Code__c  != null && prop.Postal_Code__c != ''){
            if(prop.Name != ''){
                prop.Name += ' ' + prop.Postal_Code__c; 
            }
        }
        if(prop.Name != '' && prop.Name.length() >80){
            prop.Name = prop.Name.left(80);
        }
    }
}
 
Can someone help with Test class for below.

Thanks in Advance
 
@RestResource(urlMapping='/referrallead/*')
global with sharing class ReferalProgram {
   
    @HttpGet
    global static lead getLeadById() {
        //  global static opportunity getOpportunityById() {
        RestRequest request = RestContext.request;
        String leadId = request.requestURI.substring(request.requestURI.lastIndexOf('/')+1);
        
        lead result =  [SELECT lastname,firstname,email,Phone,status FROM lead WHERE Id = :leadId]; 
        return result;
    }
    
    @HttpPost
    global static ID createlead(String firstname, String lastname,String email, String phone, String company, String leadsource, String origin, String reffname, String reflname,String rectype) {
        
        lead thislead = new lead();
        List<Lead> leadlist = [select id,lastname,email from lead where email =: email];
        contact thiscontact = new contact();
        List<Contact> conList = [select id,name,email from Contact where email =: email];
        if(leadlist.size() >0 || conList.size() >0){
            thislead.Email.addError('Email already exists');
        }
        else
        thislead.Lastname = lastname;
        thislead.Firstname = firstname;
        thislead.Email = email;
        thislead.Company = company;
        thislead.phone = phone;
        thislead.leadsource = leadsource;
        thislead.origin__c = origin;
        thislead.Referrer_First_Name__c = reffname;
        thislead.Referrer_Last_Name__c = reflname;
        thislead.RecordTypeId = '012D00000007Q8D';
        insert thislead;
        return thislead.Id;
    }

    @HttpPatch
    global static ID updateleadFields() {
        RestRequest request = RestContext.request;
        String leadId = request.requestURI.substring(
            request.requestURI.lastIndexOf('/')+1);
        lead thislead = [SELECT Id FROM lead WHERE Id = :leadId];
        // Deserialize the JSON string into name-value pairs
        Map<String, Object> params = (Map<String, Object>)JSON.deserializeUntyped(request.requestbody.tostring());
        // Iterate through each parameter field and value
        for(String fieldName : params.keySet()) {
            // Set the field and value on the Lead sObject
            thislead.put(fieldName, params.get(fieldName));
        }
        update thislead;
        return thislead.Id;
    }    
}