• Santosh Bompally 8
• NEWBIE
• 209 Points
• Member since 2018

• Chatter
Feed
• 5
• 0
• 0
Likes Given
• 0
Questions
• 33
Replies
I am trying to do an exercise from a Pluralsight course. Requirement is to get the lowest competitor price and populate the name of the competitor and the price:

My code:
```trigger CompetitorPrice5 on Opportunity (before insert, before update) {

Map<id, Opportunity> BestPriceM = new Map<id, Opportunity>();

//select all records into a map
Map<id, Opportunity> m = new Map<id, Opportunity>([select id, competitor1__c, competitor_2__c,
competitor_3__c, Competitor_Price_1__c,
Competitor_Price_2__c, Competitor_Price_3__c,
Best_Competitor_Price__c,Best_Competitor__c
from opportunity
where id in :trigger.Newmap.keySet()]);

//process the record one by one and assign to the new list
Decimal LowestPrice;
Decimal CurrentPrice;
String CompName;

for(Id i : m.keySet()){
List<Decimal> AllPrices = new List<Decimal>();
// System.debug('Values of AllPrices ' + AllPrices);
List<String> AllComps = new List<String>();

//compare each competitor's price with the LowestPrice and update if competitor's price is less
for(Integer l; l < AllPrices.size(); l++)
{
CurrentPrice = AllPrices.get(l);
if(CurrentPrice < LowestPrice)
{
LowestPrice = CurrentPrice;
CompName = AllComps.get(l);
}

}
//update Best Competitor and Best Competitor Price fields
m.get(i).Best_Competitor_Price__c = LowestPrice;
m.get(i).Best_Competitor__c = CompName;
}
}```
The problem is I keep getting a null values in AllPrices and AllComps lists and the update doesn't happen. The code compiles fine though. Please help...

Is it possible to show the marker in Green color instead of red color in lightning:map tag?
What is the process for regaining access to a Developer Org (Admin) User that is locked? I have acces to the second User Account (it's a Standard User, not a Admin User). I did reach out to @asksalesforce on Twitter as suggested in this Trailblazer Community Post, "Can't login to developer org. How to contact Salesforce support?" and they directed me to post on Dev Forums for assistance.

Thanks, and any help/suggestions are appreciated.
Hi All,

I have sandbox1 from org1 and sandbox2 from org2, I'm trying to create a package from sandbox1 and wanted to deploy in sandbox2.
Though org's are different, we still have few common custom objects. We have object1, object2, object3 as common in sandbox1 and sandbox2.

Now, the problem is each of these objects in each org has different fields.I don't want to lose existing fields in sandbox2 and just want to add the additional fields from sandbox1 to sandbox2.

How can we achieve this by package ?
Hi,

I have a Checkbox (GST__c) on an object called Product2, I want to  check to see if it is checked, if it is checked then apply TAX if not checked don't apply TAX.

This is what i have come up with, do I need to wrap my conditional statement in a function?
Thanks.
```public Product2 product { get {
if (product == null) {
try {
product = ([Select  GST__c from Product2 where Id = :prodId]);
} Catch (Exception e) { }
}
return product;
} set; }

public Boolean GSTRequired {get; set;}

if(product.GST__c == true){
// Tax required
GSTRequired = true;
} else {
// Tax not required
GSTRequired = false;
}```

Apex trigger creat task on lead needs to be when edited to subsequently meet criteria. right now i have it as follows:

trigger createtask on lead (after insert) {

The "after insert" needs to be changed but I'm not sure what it should be changed to.

Any help is greatly appreciated
i need a formula on process builder,with critriea opportunity stage closed won,Referral (custom field) not null and contract term <3 years

i have conterm term a picklist field with values 12,24,36,48,60,72 all in months

for <3 years one formula
for  3 years one formula and
for 4+ years one formula

i tired following one,getting error:
AND(
OR(
ISPICKVAL([Opportunity].StageName , "Closed Won"),
OR(
NOT ( ISBLANK ( [Opportunity].Referral__c )  ),
OR(
ISPICKVAL([Opportunity].ContractTerm__c <36 )) )
)
)

I am aware this ia know issue https://success.salesforce.com/issues_view?id=a1p3A000000oAQnQAM

Could someone suggest  a workaround?
I tried testing through Dev Console, as an tab but all i see is the cancel and save button

```<aura:component
implements="flexipage:availableForAllPageTypes,force:appHostable,flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName"
access="global" >

<aura:attribute name="recordId" type="String" />
<aura:attribute name="fieldsArray" type="String[]" default="['Name','Email','HomePhone','MobilePhone','AccountId']" />

<lightning:card class="slds-card__body slds-card__body_inner" iconName="standard:contact" title="Quick PersonAccount" >

<lightning:recordForm
aura:id="recordForm"
recordId="{!v.recordId}"
objectApiName="Contact"
layoutType="Compact"
fields="{!v.fieldsArray}"
columns="2"
mode="edit"
onsubmit="{!c.onSubmit}"

/>
</lightning:card>
</aura:component>```

How to make the community made of VF page+Tab to publicly accessible ? I create a community and gave Case status to my guest profile. But when I click the URL it takes me to login screen.

Hello Community Members,

I have created aBeta  managed package and installed it in my DE org. The packcage includes some detail page buttons which are calling VF pages, but when i try to click on these buttons in my DE org, it throws error as :
common.apex.runtime.impl.ExecutionException: SObject row was retrieved via SOQL without querying the requested field:

I am trying to do an exercise from a Pluralsight course. Requirement is to get the lowest competitor price and populate the name of the competitor and the price:

My code:
```trigger CompetitorPrice5 on Opportunity (before insert, before update) {

Map<id, Opportunity> BestPriceM = new Map<id, Opportunity>();

//select all records into a map
Map<id, Opportunity> m = new Map<id, Opportunity>([select id, competitor1__c, competitor_2__c,
competitor_3__c, Competitor_Price_1__c,
Competitor_Price_2__c, Competitor_Price_3__c,
Best_Competitor_Price__c,Best_Competitor__c
from opportunity
where id in :trigger.Newmap.keySet()]);

//process the record one by one and assign to the new list
Decimal LowestPrice;
Decimal CurrentPrice;
String CompName;

for(Id i : m.keySet()){
List<Decimal> AllPrices = new List<Decimal>();
// System.debug('Values of AllPrices ' + AllPrices);
List<String> AllComps = new List<String>();

//compare each competitor's price with the LowestPrice and update if competitor's price is less
for(Integer l; l < AllPrices.size(); l++)
{
CurrentPrice = AllPrices.get(l);
if(CurrentPrice < LowestPrice)
{
LowestPrice = CurrentPrice;
CompName = AllComps.get(l);
}

}
//update Best Competitor and Best Competitor Price fields
m.get(i).Best_Competitor_Price__c = LowestPrice;
m.get(i).Best_Competitor__c = CompName;
}
}```
The problem is I keep getting a null values in AllPrices and AllComps lists and the update doesn't happen. The code compiles fine though. Please help...

Hi all, we have 3 custom email address fields on contact object. Workemail__C, Personalemail__C, Departmentemail__C. I need help building a validation rule to stop users from entering duplicate email address in any of these custom email address fields.
Thank you
• September 30, 2018
• Like
• 0

In one of our customer's org, OWD is as follows
Account : Public read/write
Contacts: Controlled by parents
There is no role hierarchy.
Permission set: Force.com license to edit contacts.
All the contacts are owned by admin.
User with Force.com App subcription license has given permission set to Read, Create, Edit, View All fro contacts.

But as Contacts are controlled by parent, all those contacts which are associated with account are editable to this user. But contacts which are not associated to account are read-only for the same user, but not editable as those contacts becomes private contacts. Am I right here?

I want to make these contacts(those which are not associated to any account) editable for the User mentioned above. I read about the sharing rules also. But situation will be same as private contacts will be only read-only evenif edit button is available.

IS there any way to do this?

Is it possible to show the marker in Green color instead of red color in lightning:map tag?
• September 29, 2018
• Like
• 0
It's a shout out to experts working on cases coming from Web.I would like pick their brain on a peculiar scenario that we are facing.We are an Airline Org.When a passenger comes on web to create a case,he has to provide certain details which are not mandatory on the web.So if a passenger A comes to web and decides to provide his wrong Document number say 11111111 with his first name and last name,we create a client in Salesforce with that name and document number(if he doesnot already exist as client) and links the case with him. Now a passenger B comes for claims on web and decides to give his document number again as any random number say as 11111111. Now in this case what happens is we create a case and attach it to Passenger A.Since we think the document number 11111111 is for Passenger A.How can we apply a stringent check?Since First name and last nume can be same for people we cannot apply that check.
What is the process for regaining access to a Developer Org (Admin) User that is locked? I have acces to the second User Account (it's a Standard User, not a Admin User). I did reach out to @asksalesforce on Twitter as suggested in this Trailblazer Community Post, "Can't login to developer org. How to contact Salesforce support?" and they directed me to post on Dev Forums for assistance.

Thanks, and any help/suggestions are appreciated.
Hi All,

I have sandbox1 from org1 and sandbox2 from org2, I'm trying to create a package from sandbox1 and wanted to deploy in sandbox2.
Though org's are different, we still have few common custom objects. We have object1, object2, object3 as common in sandbox1 and sandbox2.

Now, the problem is each of these objects in each org has different fields.I don't want to lose existing fields in sandbox2 and just want to add the additional fields from sandbox1 to sandbox2.

How can we achieve this by package ?
Hi Guys,
I have new to Rest Integration and I have requirement to implement the process to consume the external rest webservices and make the callout whenever a case has been created in salesforce. For this i have creeated apex class with future methosds to handle the callouts and calling the methods from trigger.
Now I have to handle the cases that are not proccesed or errored due to some server errors.
Can any one suggest me the best way to handle the error callout transactions ?
Appriciated your great suggestions.

Thanks,
This code works for my requirement but I need test class please.

{
String ProfileId = UserInfo.getProfileId();
List<Profile> profiles=[select id from Profile where name='Profile 1' or name='Profile 2'];

if (2!=profiles.size())
{
// unable to get the profiles - handle error
}
else
{
for (Task a : Trigger.old)
{
if ( (profileId==profiles[0].id) || (profileId==profiles[1].id) )
{
a.addError('You can't delete this record');
}
}
}
}
• August 30, 2018
• Like
• 0
Hi All,

It looks like this unit has been causing trouble for many, but I haven't been able to find someone who is encountering the same error I am, so hoping someone here can help. The error is as follows: "Problem Logging In We can't log you in because of the following error. ERROR_CREATING_USER: Required fields are missing: [Last Name]"

I have read through as many threads on this as I could find and have tried many of the common solutions, all having failed to resolve my issue:

1) Google as a login option is enabled under Administration > Login & Registration
2) I have tried logging in through Google on both the Partner and Customer communities that you create as part of this module
3) I did launch the URL in an incognito tab
4) I used the Module3RegistrationHandler.cls for my Apex class from the following location: https://github.com/salesforceidentity/IdentityTrail-Module3

I'm a BA/Admin so the code is over my head; can someone please help? I would really like to clear this unit.

Thank you in advance!
Kate