• IanDonegan
  • NEWBIE
  • 60 Points
  • Member since 2018
  • CTO
  • CoCounselor


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 8
    Replies
Hello Developers!

I need help merging the two (2) triggers below into one (1) trigger. Any assistance is greatly appreciated. Thank you!

Trigger 1:
Trigger OpptyProducts_Spring on Opportunity (before update) {

list<opportunity> sl = trigger.new;

list<opportunityLineItem> slnu = new list<opportunityLineItem>([select id ,product2.name, opportunityId from opportunitylineitem where IsSpring__c = TRUE AND  opportunityId =: trigger.new[0].id]);

string productName='';

for(opportunityLineItem opp : slnu){

 productName += opp.product2.name + '\n'; // + operator for concatenation.

}

for(Opportunity opp : trigger.new){

 opp.Spring_Products__c = productName;


}


}

Trigger 2:
Trigger OpptyProducts_Fall on Opportunity (before update) {

list<opportunity> sl = trigger.new;

list<opportunityLineItem> slnu = new list<opportunityLineItem>([select id ,product2.name, opportunityId from opportunitylineitem where IsFall__c = TRUE AND  opportunityId =: trigger.new[0].id]);

string productName='';

for(opportunityLineItem opp : slnu){

 productName += opp.product2.name + '\n'; 

}

for(Opportunity opp : trigger.new){

 opp.Fall_Products__c = productName;


}


}

 
  • June 27, 2019
  • Like
  • 0
Hello, All.

I am trying to get information about users including IsActive and IsFrozen. IsActive is on the User object while IsFrozen is on the UserLogin object. The UserLogin object contains a User lookup field with an API name of UserId, (According to this documentation page: https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_UserLogin.htm)

Queries to the UserLogin work fine:
/services/data/v45.0/query/?q=select+Id,IsFrozen,UserId+from+UserLogin

Queries to the User work fine:
/services/data/v45.0/query/?q=select+Id,IsActive+from+User

But combining the two into one query fails:
/services/data/v45.0/query/?q=select+Id,IsFrozen,UserId,UserId.IsActive+from+UserLogin

I am modeling my combined query after the another cross-object query that I have verified is working correctly:
/services/data/v45.0/query/?q=select+Id,Account.Name+from+Contact

What am I doing wrong here?



 
Hello All,

We have Field Sets, which show up in one column when we edit them, and visualforce pages that show those fields in two columns. Every time someone wants a change, have to draw out the changes on paper, work backwards to get the one column list, and then manually compare them. This would be much easier if we could either:

1. Edit the field set in two columns so it looks exactly as it will when rendered in the visualforce page

2. Render the fieldset out of order (something like the pseudo-apex code below)
for (Integer i; i < FieldSet.size(); i++) {
  Integer LeftColumnPlace = 0;
  Integer RightColumnPlace = RoundUp(FieldSet.Size()/2);
  if (i is not odd) {
    Display(FieldSet.get(LeftColumnPlace));
    LeftColumnPlace++;
  } else {
    Display(FieldSet.get(RightColumnPlace));
    RightColumnPlace++;
  }
}


 
Hello All,

We have an apex class that makes an http callout to endpoints returned by a soql query. Right now, if one of the returned endpoints does not have a Remote Site entry, the entire scheduled job fails. If there is one error, everything stops.

Is there a way to do either of these things:

1. Verify that there is a valid remote site entry for each endpoint before making the callout, so as to prevent these errors

2. Allow the execution to continue after encountering this kind of error, allowing the "approved" callouts

Thank you, to all respondants.
Hello, All.

I am writing an Apex test and encountering a couple of errors.

This portion of the class:
System.debug('Get Client Record Type ID');
        String ClientRecordTypeID = Schema.Sobjecttype.Contact.getRecordTypeInfosByName().get('Client').getRecordTypeId();

        System.debug('Insert Account');
        Account ac = new Account(Name='test');
        insert ac;

        System.debug('Insert contacts');
        List<Contact> clients = new List<Contact>();
        for (integer i = 0; i < 3; i++) {
            Contact c = new Contact();
            c.firstName = 'test';
            c.lastName = 'test' + i;
            c.Birthdate = System.today();
            c.AccountId = ac.Id;
            c.Email = 'fake@fake.com';
            c.RecordTypeId = ClientRecordTypeID;
            clients.add(c);
        }

        System.debug('---');
        List<Database.SaveResult> results = Database.insert(clients, false);
        System.debug('---');

        for (Database.SaveResult r: results) {
            System.debug(r);
        }
Produces this portion of the debug log:
12:44:17.6 (7729678)|USER_DEBUG|[7]|DEBUG|Get Client Record Type ID
12:44:17.6 (617672538)|USER_DEBUG|[10]|DEBUG|Insert Account
12:44:18.42 (1042384178)|USER_DEBUG|[14]|DEBUG|Insert contacts
12:44:18.42 (1045430887)|USER_DEBUG|[28]|DEBUG|---
12:44:18.42 (1278714555)|USER_DEBUG|[35]|ERROR|()
12:44:18.42 (1278873811)|USER_DEBUG|[44]|ERROR|()
12:44:18.42 (1301826736)|USER_DEBUG|[30]|DEBUG|---
12:44:18.42 (1302330854)|USER_DEBUG|[33]|DEBUG|Database.SaveResult[getErrors=();getId=0030H00005CBCFhQAP;isSuccess=true;]
12:44:18.42 (1302454551)|USER_DEBUG|[33]|DEBUG|Database.SaveResult[getErrors=();getId=0030H00005CBCFiQAP;isSuccess=true;]
12:44:18.42 (1302565041)|USER_DEBUG|[33]|DEBUG|Database.SaveResult[getErrors=();getId=0030H00005CBCFjQAP;isSuccess=true;]
My concerns lie with the two ERROR messages between the "---" debug messages, seeming to come from the insert operation.

The errors do not seem to be causing any problems, and the insert operation is reporting success, but I cannot identify where the errors are coming from. Does anyone here have any ideas?

 
I would like to keep track of the instance names of orgs I am the administrator for without having to manually handle instance refreshes. Periodically querying those orgs would allow me to access a reletively up-to-date list of clients that are affected by issues listed on trust.salesforce.com.

Is this possible?
I have an external app that I would like to use to create records of a custom object through the rest API. I can create Accounts just fine, but have not been able to replicate that functionality for any custom object.

I took a look at workbench.developerforce.com, and found that the rest explorer is not returning information about any custom objects.

I am logged in as a system administrator, so I should have access to everything. What am I doing wrong?
Hello, All.

I am trying to get information about users including IsActive and IsFrozen. IsActive is on the User object while IsFrozen is on the UserLogin object. The UserLogin object contains a User lookup field with an API name of UserId, (According to this documentation page: https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_UserLogin.htm)

Queries to the UserLogin work fine:
/services/data/v45.0/query/?q=select+Id,IsFrozen,UserId+from+UserLogin

Queries to the User work fine:
/services/data/v45.0/query/?q=select+Id,IsActive+from+User

But combining the two into one query fails:
/services/data/v45.0/query/?q=select+Id,IsFrozen,UserId,UserId.IsActive+from+UserLogin

I am modeling my combined query after the another cross-object query that I have verified is working correctly:
/services/data/v45.0/query/?q=select+Id,Account.Name+from+Contact

What am I doing wrong here?



 
Is there anyway to access a playground I removed from my list of managed orgs? I am getting a email for an Apex exception every single day from a automated process in this playground and would like these emails to stop. Any help would be awsome!
Hello All,

We have an apex class that makes an http callout to endpoints returned by a soql query. Right now, if one of the returned endpoints does not have a Remote Site entry, the entire scheduled job fails. If there is one error, everything stops.

Is there a way to do either of these things:

1. Verify that there is a valid remote site entry for each endpoint before making the callout, so as to prevent these errors

2. Allow the execution to continue after encountering this kind of error, allowing the "approved" callouts

Thank you, to all respondants.
Hello! 
So, I have an object in which I have fields like first name, last name, email etc which I am importing from a csv using data import wizard . I have another object where I need have some common fields from object1 and some new fields, here I need the users to enter their name but I need them to pick those up from the first name field in object1. Basically what I want to do is create a lookup relationship beteween the 2 objects but based on the particular field, the users should be able to choose their first name from the list that I've imported. I've been trying to figure a way out of this for 2 days but couldn't. Can anyone help?
I would like to keep track of the instance names of orgs I am the administrator for without having to manually handle instance refreshes. Periodically querying those orgs would allow me to access a reletively up-to-date list of clients that are affected by issues listed on trust.salesforce.com.

Is this possible?
Hello Developers!

I need help merging the two (2) triggers below into one (1) trigger. Any assistance is greatly appreciated. Thank you!

Trigger 1:
Trigger OpptyProducts_Spring on Opportunity (before update) {

list<opportunity> sl = trigger.new;

list<opportunityLineItem> slnu = new list<opportunityLineItem>([select id ,product2.name, opportunityId from opportunitylineitem where IsSpring__c = TRUE AND  opportunityId =: trigger.new[0].id]);

string productName='';

for(opportunityLineItem opp : slnu){

 productName += opp.product2.name + '\n'; // + operator for concatenation.

}

for(Opportunity opp : trigger.new){

 opp.Spring_Products__c = productName;


}


}

Trigger 2:
Trigger OpptyProducts_Fall on Opportunity (before update) {

list<opportunity> sl = trigger.new;

list<opportunityLineItem> slnu = new list<opportunityLineItem>([select id ,product2.name, opportunityId from opportunitylineitem where IsFall__c = TRUE AND  opportunityId =: trigger.new[0].id]);

string productName='';

for(opportunityLineItem opp : slnu){

 productName += opp.product2.name + '\n'; 

}

for(Opportunity opp : trigger.new){

 opp.Fall_Products__c = productName;


}


}

 
  • June 27, 2019
  • Like
  • 0
I have an external app that I would like to use to create records of a custom object through the rest API. I can create Accounts just fine, but have not been able to replicate that functionality for any custom object.

I took a look at workbench.developerforce.com, and found that the rest explorer is not returning information about any custom objects.

I am logged in as a system administrator, so I should have access to everything. What am I doing wrong?
Hi Everybody,
I am doing the Create Formula Fields module and in the first part it ask you to select Sales User and System Administrator in the Visible column but the Sales User profile does not appear as a selection that you can check?
Would like to know if anybody can help me with this?