• RainnyCloudy
  • NEWBIE
  • 55 Points
  • Member since 2016
  • Developer
  • None

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 13
    Replies
I have a custom button that I would like to validate against the Status field. 
If Status does not equal "Approved by Business Manager" return an error message. 

I have tried the following but does not work:

IF({!ISPICKVAL( Invoice__c.Status__c , "Approved by Business Manager")},
/apex/loop__looplus?sessionId={!$Api.Session_ID}&eid={!Invoice__c.Id}
&ddpids=a0Z50000009UjxA&deploy=a0Y500000091MwT
&contactid=0035000002ZrYHU,
Alert('Value can only be Approved by Business Manager'))
I have a Trigger on Opportunity which is working fine except for 1 field.... 
 
for(Opportunity run: Trigger.new){

 Opportunity old = Trigger.oldMap.get(run.Id);
        if (trigger.isupdate && run.invitar_al_centro_de_experiencia__c == true && old.invitar_al_centro_de_experiencia__c == true )
        {

 invitacion_al_centro_de_experiencia__c cand = new invitacion_al_centro_de_experiencia__c();
                cand = [SELECT id, name FROM invitacion_al_centro_de_experiencia__c WHERE oportunidad_relacionada__c =: run.id LIMIT 1];

 cand.Tipo_de_Oportunidad__c = string.valueof(run.recordtype.name);

}

}

The "run.recordtype.name" returns null
but if i change that line to "run.recordtypeid" it shows me the recordtype ID indeed. 
I tried with and without the "string.valueof()" and still getting "null"...and checked out the recordtype and it does have a name....
(I cut the code, so sorry if there is not a "{", "}", or anything written) 

What am i doing wrong?
  • January 26, 2016
  • Like
  • 0
Anyone else having issues with the force.com ide and java 8? I can't seem to get the fields for both standard and custom objects to be selectable. 
HI all,
I am new to salesforce, please give me some solution ...
 i want to Create a tab – “Account Information”.

When user clicks on this tab, he should be redirected to a visual force page which looks like:
Account Name should be a link and on click of it should redirect to standard Account Detail Page
 
Account NameNo of Contacts
Acc12
Acc26
Acc313
please give me solution...
Hello,

Is there a way to add a new item to an existing picklist?

Thank you,
Bradley
Hi thanks to SF Issue-Fixer, we got this awesome trigger but for some reason we can't get it to completely fire correctly. 

The trigger was to have a status change on a feed comment so here is the first one: 

This trigger allows anyone's feed comment to change the status

01trigger CommentStatusUpd on FeedComment (after insert) {
02     
03    for (FeedComment feedcs : trigger.new){
04         
05        List<CaseFeed> chkCsFeed = [ SELECT Id FROM CaseFeed WHERE ParentId=: feedcs.ParentId ];
06        if( chkCsFeed.size() > 0){
07            system.debug('***DEBUG***'+feedcs.ParentId);           
08            List<Case> Pros = new List<Case>([ SELECT CaseNumber, Id, Status FROM Case WHERE Id =: feedcs.ParentId ]);
09            for (integer i = 0; i < Pros.size(); i++){
10                system.debug('***DEBUG-INFO: CaseId***'+Pros[i].Id);
11                system.debug('***DEBUG-INFO: CaseNumber***'+Pros[i].CaseNumber);
12                system.debug('***DEBUG-INFO: CaseStatus***'+Pros[i].Status);
13                Pros[i].Status = 'Working';
14            }
15            update Pros;
16             
17        }
18         
19    }
20     
21}

However, we only wanted the status to change if a specific profile (00e800000018sx8) so only their feed comment on a case would change the status from "Awaiting Customer Feedback" to "Working": 

This trigger is supposed to only have the status change when 00e800000018sx8​ profile makes a feed comment. 

  trigger UpdateCommStatus on FeedComment (before insert) {
    for (FeedComment feedcs : trigger.new){
        List<CaseFeed> chkCsFeed = [ SELECT Id FROM CaseFeed WHERE ParentId=: feedcs.ParentId ];
        if( chkCsFeed.size() > 0){
            system.debug('***DEBUG***'+feedcs.ParentId);
            List<Case> Pros = new List<Case>([ SELECT CaseNumber, Id, Status, OwnerId FROM Case WHERE Id =: feedcs.ParentId ]);
            for (integer i = 0; i < Pros.size(); i++){
                List<User> Usrs = new List<User>([ SELECT ProfileId FROM User WHERE Id=: Pros[i].OwnerId ]);
                for (User usrprofile : Usrs) {
                    if( usrprofile.ProfileId == '00e800000018sx8' ) {
                        Pros[i].Status = 'Working';       
                    }
                }
            }
            update Pros;
        }
    }
}  

There are some differents between the two triggers which both are supposed to change the status. Can anyone help with figuring out why it is not firing for the profile? 

Thanks, 
 
Is there anyway I can schedule a Workflow rule/process builer to execute at a specific time of the day everyday, rather than running when something happens to a record(created/updated).

scenario - I want to find out all the cases that are not closed, 7 days after they are created. I would like to then update the field priority to high.

Workflow rules/process builder executes only after a record is either created or updated but what if I want to take action on all records matching a criteria, repeatedly everyday.  

Thanks
Mahesh
We monitor customer revenue with a custom field, that is updated every day (history tracking is activiated). 
Whenever the revenue falls below a certain percantage threshold I would like to triigger an alert email or task. 
I found out that i can use <after update> for custom fileds but am quite lost on the next steps. 
Thanks for your help! 
 
Hello,

when we execute test methods for one class (and only one class, no problem for others), we're getting this error:
Internal Salesforce Error: 20878693-139583 (-1872511937) (-1872511937)
Stack Trace: null
This error occurs only on production instance, not on sandbox. I don't know how to fix that, anyone can help?
Thanks!
I have a custom button that I would like to validate against the Status field. 
If Status does not equal "Approved by Business Manager" return an error message. 

I have tried the following but does not work:

IF({!ISPICKVAL( Invoice__c.Status__c , "Approved by Business Manager")},
/apex/loop__looplus?sessionId={!$Api.Session_ID}&eid={!Invoice__c.Id}
&ddpids=a0Z50000009UjxA&deploy=a0Y500000091MwT
&contactid=0035000002ZrYHU,
Alert('Value can only be Approved by Business Manager'))
I am having a issue with my trigger. When i try to do a mass update on account records I get this error message.  Too many SOQL queries: 101 Trigger_CasePrimaryContact: line 7, column 1 

my trigger code is below, any help with issue would be greatly appreciated. 
 
trigger Trigger_CasePrimaryContact on Account (before insert, before update) {


   for (Account a : Trigger.new) {
   
       AccountContactRole[] contactRoleArray =
       [select ContactID, Role from AccountContactRole where AccountId = :a.id AND Role='Asset Management Service Contact' ];
       if (contactRoleArray.size() > 0) {
         
        
           a.Account_Case_Contact__c = contactRoleArray[0].ContactID;
          
       }else{
      
           // IF NO CONTACT ROLES EXIST RETURN NULL...
           a.Account_Case_Contact__c = null;
         
       }
   }
    


}
  • January 26, 2016
  • Like
  • 0
I have a Trigger on Opportunity which is working fine except for 1 field.... 
 
for(Opportunity run: Trigger.new){

 Opportunity old = Trigger.oldMap.get(run.Id);
        if (trigger.isupdate && run.invitar_al_centro_de_experiencia__c == true && old.invitar_al_centro_de_experiencia__c == true )
        {

 invitacion_al_centro_de_experiencia__c cand = new invitacion_al_centro_de_experiencia__c();
                cand = [SELECT id, name FROM invitacion_al_centro_de_experiencia__c WHERE oportunidad_relacionada__c =: run.id LIMIT 1];

 cand.Tipo_de_Oportunidad__c = string.valueof(run.recordtype.name);

}

}

The "run.recordtype.name" returns null
but if i change that line to "run.recordtypeid" it shows me the recordtype ID indeed. 
I tried with and without the "string.valueof()" and still getting "null"...and checked out the recordtype and it does have a name....
(I cut the code, so sorry if there is not a "{", "}", or anything written) 

What am i doing wrong?
  • January 26, 2016
  • Like
  • 0