• Ankit Khiwansara 10
  • NEWBIE
  • 30 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 3
    Replies
How to populate value in Contact.photoURL  

While executing below code, getting below error 

contact c = new contact (id = '0030o00002cWalwAAC');
c.photoURL = '/servlet/servlet.FileDownload?file=0150o00000HDM4s';
update c;    

Field is not writeable: Contact.PhotoUrl.

Could you please help me to execute below error.
 
HI Friends,

Could you please help me to create custom objects with tabs and pagelayout (without data) from one salesforce org to other salesforce org either with VSCODE or workbench
Hi Folks,
I am newbie on lightning and trying to learn custom validation on salesforce.
 
I want to validate email field value should only be rahul@gmail.com.For rest of the values , i want to populate error on component, but unable to do so. Could you please help me on that.
 
({
    newContactCreation: function (component, event, helper) {
        // Getting all fields and iterate them to check for validity
        var allValid = component.find('formFieldToValidate').reduce(function (validSoFar, inputCmp) {
            // Show help message if single field is invalid
            inputCmp.showHelpMessageIfInvalid();
            // Get the name of each field
            var name = inputCmp.get('v.name');
            // Check if name is emailField
            if (name == 'emailField') {
                // Getting the value of that field
                var value = inputCmp.get('v.value');
                // If value is not equal to rahul@gmail.com, add custom validation
                if (value != 'rahul@gmail.com') {
                    // Focus on that field to make custom validation work
                    //inputCmp.focus();
                    // Setting the custom validation
                    inputCmp.set('v.validity', { valid: false, badInput: true });
                    inputCmp.showHelpMessageIfInvalid();
                }
            }
            // Returning the final result of validations
            return validSoFar && inputCmp.get('v.validity').valid;
        }, true);

        if (allValid) {
            var action = component.get("c.createContact");
            action.setParams({
                con: component.get("v.con"),
                accountId: component.get("v.accountId")
            });

            action.setCallback(this, function (response) {
                var state = response.getState();
                if (state === "SUCCESS") {
                    windows.location.reload();
                } else {
                    alert("Problem in Data Fetching");
                }
            });

            $A.enqueueAction(action);
        }
    }
});



 
<aura:component controller="ElevenLCController">
    <aura:attribute name="accountId" type="String" />
    <aura:attribute name="con" type="Contact" default="{'Sobject' : 'Contact',
'FirstName' :'',
'LastNmae':'',
'Email':'',
'Phone':''}" />
    <div class="slds-p-around_x-small">
        <lightning:input required="true" aura:id="formFieldToValidate" label="First Name" value="{!v.con.FirstName}"
            type="text" messageWhenValueMissing="Please Enter First Name" />
        <lightning:input required="true" aura:id="formFieldToValidate" label="Last Name" value="{!v.con.LastName}"
            type="text" messageWhenValueMissing="Please Enter Last Name" />
        <lightning:input required="true" aura:id="formFieldToValidate" name="emailField" label="Email"
            value="{!v.con.Email}" type="Email" messageWhenBadInput="Enter Valid Email Id"
            messageWhenValueMissing="Please Enter Email" />
        <lightning:input required="true" aura:id="formFieldToValidate" label="Phone" value="{!v.con.Phone}"
            type="tel" />
    </div>
    <br />
    <lightning:button variant="brand" label="Create Contact" onclick="{!c.newContactCreation}" />
</aura:component>
I have before insert trigger on the Lead object to fetch the Territory__c object, where the Territory__c.PostalCode__c matches the Lead.PostalCode. The code fails uses the Apex Data Loader to insert 10,000 Lead records.

code block:

 for (Lead l : Trigger.new){
    if (l.PostalCode != null) {
        List<Territory__c> terrList = [SELECT Id FROM Territory__c WHERE PostalCode__c = :l.PostalCode];
        if(terrList.size() > 0) 
            l.Territory__c = terrList[0].Id; 
    }
}
Hello Friends,
I am preparing for DEV 1 certification . While going over sample questions, came accross below question. 

In which two trigger types a developer modify new sObjct Record that are obtained by trigger.new context.
A) After Insert
B) After Update
C) Before Update
D) Before Insert

I think ans for this is Before Update and Before Insert, 
As record firre by after triggers are readonly since it has completed DB operation.

Could you please confirm whether my understanding is correct.
Hello,

Could you please help me how to scan substring within the string.

Scanned String - Ankit

Example - My Name is Ankit -- Search found and answer should be True or Ankit.

Example - My Name is Ankita -- Search not found (As user searching for Ankit not Ankita) and answer should be False.

I am trying to use indexOfIgnoreCase(string) , but this is failing in second scenario.
Hello ,
I have created two lookup relationship on Contact object with Account Object. 
But i am unable to use SOQL query with one of the relationship. Can you please help me on this.
 Relationship Working with CustomAccount FieldRelationship not working with CustomContacts RelationshipUser-added imageUser-added image
Could you please help me to understand, as both the relationship from contact to account are same, why SOQL is working with other relationship and not with other one
Hello ,
I have created two lookup relationship on Contact object with Account Object. 
But i am unable to use SOQL query with one of the relationship. Can you please help me on this.
 Relationship Working with CustomAccount FieldRelationship not working with CustomContacts RelationshipUser-added imageUser-added image
Could you please help me to understand, as both the relationship from contact to account are same, why SOQL is working with other relationship and not with other one
https://developer.salesforce.com/trailhead/advanced_formulas/picklist_formulas
Has anyone managed to pass the challenge?
Gives error:
Challenge Not yet complete... here's what's wrong: 
The validation rule does not appear to be working correctly. Marking IsEscalated to true and Priority to Medium did not fire the validation rule.

Testing that same case myself (and some permuations) the Validation rule fires correctly I think...
Here is my validation formula
AND(
ISPICKVAL( Status , "Escalated"),
OR(
IsClosed,
IsClosedOnCreate,
NOT(ISPICKVAL( Priority , "High"))
)
)