+ Start a Discussion
BDeigsBDeigs 

I can't get this to work and was hoping someone can help...  Any thoughts?

 

IF(BEGINS( Phone , "(804)"), "Richmond",
IF(BEGINS(Phone , "(757)"),"Virginia Beach - Norfolk",
IF(BEGINS(Phone , "(704):(980)"),"Raleigh",
IF(BEGINS(Phone , "(919)"),"Charlotte",
IF(BEGINS(Phone , "(813):(727):(941)"),"Tampa",
IF(BEGINS(Phone , "(321):(407)"),"Orlando",
IF(BEGINS(Phone , "(904)"),"Jacksonville",
IF(BEGINS(Phone , "(770):(678):(404)"),"Atlanta",
IF(BEGINS(Phone , "(914):(631):(516):(347):(718):(917):(212):(646):(862):(973):(201):(551)"),"NYC - Newark",
IF(BEGINS(Phone , "(484):(610):(835):(215):(267):(856):(609):(302)"),"Philadelphia",
IF(BEGINS( Phone , "(781):(857):(339):(617)"),"Boston",
IF(BEGINS(Phone , "(716):(858)"),"Buffalo",
IF(BEGINS(Phone , "(860)"),"Hartford",
IF(BEGINS(Phone , "(401)"),"Providence",
IF(BEGINS(Phone , "(305):(786):(954):(754)"),"Miami",
IF(BEGINS(Phone , "(412):(878)"),"Pittsburgh",
IF(BEGINS(Phone , "(513)"),"Cincinnati",
IF(BEGINS(Phone , "(216):(440)"),"Cleveland",
IF(BEGINS(Phone , "(614)"),"Columbus",
IF(BEGINS(Phone , "(571):(703):(202):(240):(301)"),"DC",
IF(BEGINS(Phone , "(410):(443)"),"Baltimore",
"?-Non-metro")))))))))))))))))))))

Best Answer chosen by Admin (Salesforce Developers) 
jhurstjhurst

Not quite sure what the issue you are seeing is, but my guess is that you see a "?-Non-Metro" for any of the cities you are using the OR for.  If that is the case, it is because you are using an invalid OR designation.  By including the : in the quotes you are using them as a matching string.  So to get "Raleigh" the number would have to start with the string "(704):(980)".

 

I was able to get what I think you are looking for with the formula:

 

IF(BEGINS( Phone , "(804)"), "Richmond",
IF(BEGINS(Phone , "(757)"),"Virginia Beach - Norfolk",
IF(BEGINS(Phone , "(704)") || BEGINS(Phone, "(980)"),"Raleigh",
IF(BEGINS(Phone , "(919)"),"Charlotte",
IF(BEGINS(Phone , "(813)") || BEGINS(Phone , "(727)") || BEGINS(Phone , "(941)"),"Tampa",
IF(BEGINS(Phone , "(321)") || BEGINS(Phone , "(407)"),"Orlando",
IF(BEGINS(Phone , "(904)"),"Jacksonville",
IF(BEGINS(Phone , "(770)") || BEGINS(Phone , "(678)") || BEGINS(Phone , "(404)"),"Atlanta",
IF(BEGINS(Phone , "(914)") || BEGINS(Phone , "(631)") || BEGINS(Phone , "(516)") || BEGINS(Phone , "(347)") || BEGINS(Phone , "(718)") || BEGINS(Phone , "(917)") ||
     BEGINS(Phone , "(212)") || BEGINS(Phone , "(646)") || BEGINS(Phone , "(862)") || BEGINS(Phone , "(973)") || BEGINS(Phone , "(201)") || BEGINS(Phone , "(551)"),"NYC - Newark",
IF(BEGINS(Phone , "(484)") || BEGINS(Phone , "(610)") || BEGINS(Phone , "(835)") || BEGINS(Phone , "(215)") || BEGINS(Phone , "(267)") || BEGINS(Phone , "(856)") ||
     BEGINS(Phone , "(609)") || BEGINS(Phone , "(302)"),"Philadelphia",
IF(BEGINS(Phone , "(781)") || BEGINS(Phone , "(857)") || BEGINS(Phone , "(339)") || BEGINS(Phone , "(617)"),"Boston",
IF(BEGINS(Phone , "(716)") || BEGINS(Phone , "(858)"),"Buffalo",
IF(BEGINS(Phone , "(860)"),"Hartford",
IF(BEGINS(Phone , "(401)"),"Providence",
IF(BEGINS(Phone , "(305)") || BEGINS(Phone , "(786)") || BEGINS(Phone , "(954)") || BEGINS(Phone , "(754)"),"Miami",
IF(BEGINS(Phone , "(412)") || BEGINS(Phone , "(878)"),"Pittsburgh",
IF(BEGINS(Phone , "(513)"),"Cincinnati",
IF(BEGINS(Phone , "(216)") || BEGINS(Phone , "(440)"),"Cleveland",
IF(BEGINS(Phone , "(614)"),"Columbus",
IF(BEGINS(Phone , "(571)") || BEGINS(Phone , "(703)") || BEGINS(Phone , "(202)") || BEGINS(Phone , "(240)") || BEGINS(Phone , "(301)"),"DC",
IF(BEGINS(Phone , "(410)") || BEGINS(Phone , "(443)"),"Baltimore",
"?-Non-metro")))))))))))))))))))))

 Hope this helps.

Jay

Rohit TripathiRohit Tripathi 
I am getting error message while solving this challenge in Trailhead :

To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)

Error Message is :  There was an unhandled exception. Please reference ID: HKIZNLVZ. Error: Trailhead::TrailheadTimeOut. Message: Trailhead.view: failed to get a 200 response. Made 3 attempts each resulting in a 403 or 500 failure for url challenges?key=%5B%22trailhead.challenge.validation_rules.en.us.192%22%5D.

I am not sure what went wrong here.
My Validation Rule is on Contact Object  :

  AND ( NOT(ISBLANK( Account.Name)),
( MailingPostalCode <> Account.ShippingPostalCode))

Can anyone please help with this.
Best Answer chosen by Rohit Tripathi
Amit Chaudhary 8Amit Chaudhary 8
Please try below valudation rule
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode != Account.ShippingPostalCode
)
i Used same and got all points in Trailhead challenge


 
Shaolin MasterShaolin Master 
I want to know how to parse the URL params from a get request
/services/apexrest/Endpoint/?subject=test&status=active&priority=1&origin=?subject=test&status=active&priority=1
I want to parse the url params in the class below
@HttpGet
    global static void getStatus() {
        RestRequest request = RestContext.request;
        System.debug(request.requestURI); 
        
    }

Please help!
Best Answer chosen by Shaolin Master
Maharajan CMaharajan C
Hi,

You have to write like below to parse the request:
@HttpGet
global static void getStatus() {
    RestRequest req = RestContext.request;
    String subject = req.params.get('subject');
    String status = req.params.get('status');
    String priority = req.params.get('priority');
    String origin = req.params.get('origin');
    
    system.debug('subject --> ' + subject  + ' status --> ' + status + 'priority --> ' + priority + 'origin --> ' + origin);

}

Thanks,
Maharajan.C
Michele Losch 4Michele Losch 4 
I'm unable to check step 2: Automate Accounts because I'm receiving this error: Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: ZKCVFIZH
 
Best Answer chosen by Michele Losch 4
Michele Losch 4Michele Losch 4
I fixed my validation rules and the error went away.
Palmira AngelovaPalmira Angelova 
Hi friends,

I need to look up specific Contacts on Accounts, but only include Contacts on Accounts that have Opportunities WHERE Stage IN('X','Y','Z') i.e. what I think of as a child -> parent -> child lookup. I've been using workbench for this. 

I couldn't figure out a way to do this within the syntax, so instead I opted for Account -> Contacts WHERE Account -> Opportunities meets my criteria, which seemed to make sense to me. However, my query is getting an error telling me I can't have a child -> parent lookup in the where clause:
"MALFORMED_QUERY: 
AND Id IN(SELECT Account.Id FROM Opportunity WHERE
ERROR at Row:5:Column:24
The inner select field 'Account.Id' cannot have more than one level of relationships"

Here is my query:
SELECT Id,
       (SELECT Id FROM Contacts WHERE Send_Partner_Updates__c = TRUE)
FROM Account
WHERE Account.POS_Provider_s__c NOT IN('Toshiba ACE', 'Toshiba ACE (old, non-integrated)')
      AND Id IN(SELECT Account.Id FROM Opportunity WHERE Stage IN('6 - Deployed', '6 - Deploying', '6.5 - Fully Deployed'))

Does anyone have a way to get by this? When I tried "SELECT Id FROM Opportunity", removing the child->parent lookup within the Opportunity query, I get this error: "The selected field 'Id' in the subquery and the left operand field in the where expression in the outer query 'Id' should point to the same object type"...so I haven't been able to think of a way around these two limitations.

Thanks for your help!
Best Answer chosen by Palmira Angelova
jigarshahjigarshah
Palmira,

Change the Account.Id to AccountId in the subquery for Opportunity hence your updated Soql query will now become
SELECT Id,
    (SELECT Id FROM Contacts WHERE Send_Partner_Updates__c = TRUE)
FROM Account
WHERE Account.POS_Provider_s__c NOT IN('Toshiba ACE', 'Toshiba ACE (old, non-integrated)')
      AND Id IN (SELECT AccountId, Stage FROM Opportunity WHERE Stage IN('6 - Deployed', '6 - Deploying', '6.5 - Fully Deployed'))
Hope that helps.
abu saleh khan 20abu saleh khan 20 
I am trying to pull picklist values in to my component using schema and its methods. I am getting all the values through server controller, but in my component labels are not populating but it is showing picklist structure.

Lightning Component:

<aura:component controller="PickListController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="aname" type="Account" default="{'sObjectType':'Account'}"/>
    <aura:attribute name="picvalue" type="List"/>
   <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> 
        <lightning:input label="Enter Your Name: " value="{!v.aname.Name}"/>
        <lightning:input label="Phone Number: " value="{!v.aname.Phone}"/>
       <lightning:select value="{!v.aname.Rating}" label="Rating">       
            <option value="choose">Choose one...</option> 
            <aura:iteration items="{!v.picvalue}" var="s">
                <option value="{!s.value}"/>             
            </aura:iteration> 
        </lightning:select> 
    <lightning:button label="Submit" onclick="{!c.go}"/>
</aura:component>

Js:

({
    doInit : function(component) {        
        var pickvar = component.get("c.getPickListValuesIntoList");
        pickvar.setCallback(this, function(response) {
            var state = response.getState();
            if(state === 'SUCCESS'){
                var list = response.getReturnValue();
                component.set("v.picvalue", list);
            }
            else if(state === 'ERROR'){
                //var list = response.getReturnValue();
                //component.set("v.picvalue", list);
                alert('ERROR OCCURED.');
            }
        })
        $A.enqueueAction(pickvar);
    },
    go : function(component){
        var cvar = component.get("v.aname");
        var action = component.get("c.insertValues");
        action.setParams({acc: cvar});
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === 'SUCCESS'){
            var list1 = response.getReturnValue();
            //component.set("v.picklistValues", list);
            alert('Record Created Successfully '+list1);
            }
            else if(state === 'INCOMPLETE'){
                alert('Something is missing');   
            }
            else if(state === 'ERROR'){
                alert('Insertion Failed');   
            }
        })
        $A.enqueueAction(action);
    }
})

Server Controller:

public class PickListController {
    @AuraEnabled        
    public static List<String> getPickListValuesIntoList(){
        List<String> pickListValuesList = new List<String>();
        Schema.DescribeFieldResult fieldResult = Account.Rating.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry pickListVal : ple){
            pickListValuesList.add(pickListVal.getLabel());
            System.debug('Values in Rating are: '+pickListValuesList);
        }     
        return pickListValuesList;
    }
    @AuraEnabled        
    public static Id insertValues(Account acc){
        insert acc;   
        return acc.id;
    }
}

User-added image
Best Answer chosen by abu saleh khan 20
Maharajan CMaharajan C
HI Abu,

Change your Lightning:select as below then it works:

<lightning:select value="{!v.aname.Rating}" label="Rating">       
    <option value="choose">Choose one...</option> 
        <aura:iteration items="{!v.picvalue}" var="s">
                <option value="{!s}">{!s}</option>
        </aura:iteration> 
</lightning:select> 

Can you please Let me know if it helps or not!!!

If it helps don't forget to mark this as a best answer!!!


Thanks,
Maharajan.C
.12.12 
I want only one value from the json but i'm getting all the values how can i stop iteration or is there any way to show only one row like keeping size please help to find the solution

Thank you in Advance,

<tbody>
                        <aura:iteration items="{!v.jsonValues}" var="item" indexVar="rowIndex">  
                            <tr data-data="{!rowIndex}">
                                <td role="gridcell" tabindex="-1" data-label="Record Type Name">                            
                                    <span class="slds-grid slds-grid_align-spread">
                                        <div class="slds-truncate">                                        
                                            <span class="slds-truncate">{!item.firstName}</span>
                                        </div>
                                    </span>                            
                                </td>
                            </tr>
                        </aura:iteration>
                    </tbody>

Original Output:-
      Ramesh
      Suresh
      Rakesh

Expected Output:-
    Ramesh
Best Answer chosen by .12
Maharajan CMaharajan C
Hi, 

Please try the below any one of the way:
 
<tbody>
	<aura:iteration items="{!v.jsonValues}" var="item" indexVar="rowIndex"> 
		<aura:if isTrue="{! rowIndex == 0 }">
			<tr data-data="{!rowIndex}">
				<td role="gridcell" tabindex="-1" data-label="Record Type Name">                            
					<span class="slds-grid slds-grid_align-spread">
						<div class="slds-truncate">                                        
							<span class="slds-truncate">{!item.firstName}</span>
						</div>
					</span>                            
				</td>
			</tr>
		</aura:if>
	</aura:iteration>
</tbody>

OR
 
<tbody>
    <aura:if isTrue="{!not(empty(v.jsonValues))}">
        <tr>
            <td role="gridcell" tabindex="-1" data-label="Record Type Name">                            
                <span class="slds-grid slds-grid_align-spread">
                    <div class="slds-truncate">                                        
                        <span class="slds-truncate">{!jsonValues[0].firstName}</span>
                    </div>
                </span>                            
            </td>
        </tr>
    </aura:if>
</tbody>

Thanks,
Maharajan.C
HashiHashi 
Developer Beginner > Platform Development Basics > Get Started with Salesforce Platform

As indicated in the instruction, I created new Trealhead Playground and tried to install DreamHouse app. Then I encountered a problem. I appreciate if someone can guide me to at where I should look into to resolve the issue.

The installation page
*Choosing "Rename configuraiton ..." option also ended up on the same error screen.
User-added image
The error page

I have also recieved an email regarding this error:
Your request to install package "DreamHouse Summer 2017" was unsuccessful. None of the data or setup information in your salesforce.com organization was affected.
 
If your install continues to fail, contact Salesforce CRM Support through your normal channels and provide the following information.
 
Organization: 
User: Shinichi Hashitani
Package: DreamHouse (04tB00000009UeX)
 
Problem:
 
1. (Command_Center) Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "You must have My Domain deployed to use component c:PropertyListDaysOnMarketChart.".
 
2. (Einstein_Vision) Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "You must have My Domain deployed to use component c:EinsteinVisionDashboard.".
 
3. (House_Explorer1) Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "You must have My Domain deployed to use component c:EinsteinVisionCard.".
 
4. (Property_Explorer) Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "You must have My Domain deployed to use component c:PriceRange.".
 
5. (Property_Record_Page) Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "You must have My Domain deployed to use component c:PropertyDaysOnMarketChart.".
 
6. (dreamhouseApplicationUtilityBar) Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "You must have My Domain deployed to use component c:Bot.".
Best Answer chosen by Hashi
NagendraNagendra (Salesforce Developers) 
Hi Hashi,

Mostly this could be the issue with the link which is provided to install the unmanaged package.

As there are two links provided to install the Dreamhouse app, may I suggest you please give a try by installing the unmanaged package for summer17 org which should resolve the issue.

Following is the link which worked fine for me.
Still, if the problem persists please let us know so that we can check with the support team on the following issue.

Hope this helps.

Mark this as solved if it's resolved.

Thanks,
Nagendra 
Best Answer chosen by Jetta
sharathchandra thukkanisharathchandra thukkani
Through the constructor of the Batch class you can do that..i.e if your class is DemoBatch. In the batch class define a List and assign in the Constructor When you will create instanace of batch.. you can do something like..

global class DemoBatch implements Database.batchable<sObject>{
global List<sObject> myList;
global DemoBatch(List<sObject> objList){
myList = objList;
}

}
----------------
DemoBatch  db = new DemoBatch(objList);
db.executeBatch(db);

But you can pass the query string and you can query in the start method.
Steve ConnellySteve Connelly 
The AccountTeamMember widget (Lightning Component) displays the Role API Name instead of the Role Label.

How do i change the lightning component so it will display the role label instead of the role API name?

Here is the component code:
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="AccountTeamHelper">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="TeamMembers" type="AccountTeamMember[]" /> 	  
    <lightning:card title="Account Team" iconName="custom:custom103">
        <div style="margin: 0px 5px">
            <p class="slds-p-horizontal_small">
                <aura:if isTrue="{!v.TeamMembers.length > 0}">
                <aura:iteration items="{!v.TeamMembers}" var="member">
                    <!-- <span style="display: inline-block; margin: 3px;"><lightning:avatar src="{!member.User.SmallPhotoUrl}" alternativeText="(Avatar)" fallbackIconName="standard:avatar" variant="circle" /></span> -->
                    <span><a href="{!'/one/one.app#/sObject/' + member.User.Id + '/view'}">{!member.User.FirstName}&nbsp;{!member.User.LastName}</a> - {!member.TeamMemberRole}</span><br/>
                </aura:iteration>
                <aura:set attribute="else">
                    No account team members have been assigned to this account.
                </aura:set>
                </aura:if>
        	</p>
        </div>
    </lightning:card>
</aura:component>

 
Best Answer chosen by Steve Connelly
Maharajan CMaharajan C
Can you please mark the best answer if your issue solved !!!