• Prasanthi_s1505
  • NEWBIE
  • 33 Points
  • Member since 2021

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 21
    Replies

Suppose 3 objects are A, B, and C.

A is lookup on B and also on C. This means we can query like 

Select id from B__c where A__r.name and A__r.id....
 
Similarly  Select id from C__c where A__r.name and A__r.id....
 

Can we somehow query all 3 in one or extract fields for all 3 in one report?

 

Hi. I'm a Salesforce Admin that has never created a visualforce page before (so bare with me please). My supervisor asked me to create a visual force page that can be used to display the results of an SOQL query. What do I need to do to accomplish this? I sincerely appreciate your help!
apex class : done
rest api :- done
test calss :- done
still i am not enabel option  any one guide 
me pleaseUser-added imageThank you
 

Trying to query what ApexClass was used by a CronTrigger by determining what Trigger executed an AsyncApexJob.

The AsyncApexJob shows the Apex Class and if I can query the CronTriggerId that executed that job, I can determine what job was using that Apex Class.

The SOAP API Developer Guide shows that the Metadata for AsyncApexJob has a field for CronTriggerId but when I attempted to query that info, I received an error that the column doesn't exist for CronTriggerId.

I have to run a batch job to create child records for the parent object with the help of other child object records field information. Say i hav three objects A,B,C. Where A is the parent object and B,C are child objects, where B is already created, now i have to run batch job on parent A and taking the help of field information from child B i have to create other child C object records. Here C holds some other data  other than B.How can i achieve this.

Suppose 3 objects are A, B, and C.

A is lookup on B and also on C. This means we can query like 

Select id from B__c where A__r.name and A__r.id....
 
Similarly  Select id from C__c where A__r.name and A__r.id....
 

Can we somehow query all 3 in one or extract fields for all 3 in one report?

 

I am Looking for solution.
Kindly help me with the solution.
Thanks in Advance!
Hello, 
We have a requiremet to have atleast one opportunity Contact role associated to an opportunity. I have proces to make sure contacts are assocaited to opportunity when they are created. But for existing opportunities, when users updates thier existing opportunities, I want to send them a reminder email alert to update with Contact role. I found this (https://salesforce.stackexchange.com/questions/25622/trigger-that-counts-how-many-contact-roles-have-a-specific-role-on-an-opportunit) Apex trigger code and updated to fit my requirement. here is my code. when there is Contact role associated to the opportunity my custom field get updated correctly but when there is no contact Role this code does not update my custom field to Zero. How do I get the code to update "Number_of_Contact_Roles__c" to 0 when no contact role ? I want to use this value for email alert. 
trigger countOpportunityContactRole on Opportunity (before insert, before update) {
  // Only need to enforce rule if opportunity is Open
Map<Id, Opportunity> oppsToCheckMap = new Map<Id, Opportunity>();
    for(Opportunity opp : trigger.new) {
        // Add the opp Id to a Map(Id to Opp) if it is an insert/Upgrade trigger with a Open Status 
        
        if(opp.ForecastCategoryName == 'Pipeline' || opp.ForecastCategoryName == 'Upside' || opp.ForecastCategoryName == 'Commit')
        { 
          oppsToCheckMap.put(opp.Id, opp); 
        }
    // For each Opportunity in the map keyset get the count of the
   List<AggregateResult> result = [
             select OpportunityID, count(Id)
             from OpportunityContactRole
             where OpportunityID in :oppsToCheckMap.keySet() group by OpportunityId];
        
    for(AggregateResult aggCount : result) {

        integer roleCount = (integer)aggCount.get('expr0');
        if(roleCount == 0) {
           // update cutom field to 0
            opp.Number_of_Contact_Roles__c = roleCount;          
        }
         // update cutom field to # of contact role
           opp.Number_of_Contact_Roles__c = roleCount;
    }
   }
}

Thank you 
​​​​​​​-Yeshi
global class Positions__c
{
   global void Positionpro()
    {
        Position__c pos=new Position__c();
        
        pos.Contact_Number__C ='1569896';
        pos.Location_del__C ='tex';
        pos.Place_applied_for__C ='USA';
        pos.Position_Name__C = 'Salesforce admin';
        Pos.Qualification__c ='B.tech';
        pos.name = 'Prjwal';
        Pos.Skills_Required__c ='Communication & Salesforce admin';
        pos.Visit_for_Details__c ='https://lntcom3-dev-ed.my.salesforce.com/_ui/common/apex/debug/ApexCSIPage';
        
        
        Insert pos;
        
        if(pos.id!=null)
        {
            System.debug('Your position details Recorded sucussfully'+Pos.id);
            
            Hiring_Managers__c Hr= new Hiring_Managers__c();
            
            hr.Name ='Jakson';
            hr.HR_Contact__c ='+911230';
            hr.HR_Email__c ='xyz@gmail.com';
            hr.Mile_stone_date__c = date.newInstance(2021,12,31);
            hr.Position_Open_Date__c = date.today();
            
            hr.Position__c=pos.id;
            insert hr;
            
            if (hr.id!=null)
            {
                system.debug('Your Hr Record entered sucuufully'+hr.id);
            }
            
 
        }
              
    }
}

when excute Error like this,this is for another program..For all Procedure classes get error in this way.Please do help for me.
Hi,

I have contact object with Team Member as child object.
The child object has a field --- allocation.
My requirement is sum of allocations cant exceed 100%. I tried a validation rule by doing a roll up summary and saving that in a field and then validating that it should throw error when this summary field is greater than 100. It's not working.

Alternatively, I wrote a trigger and that too is not working. Please help.

trigger TrigAllocToTeam on Team_Member__c (before insert, before update) {
    for(Team_Member__c tm:Trigger.new){
        //Contact con=[SELECT Id FROM Contact where Id=:tm.Contact_Resource__r.id];
        List <Team_Member__c> tms = [SELECT ID, Allocation_to_Team__c FROM Team_Member__c 
                                    WHERE Contact_Resource__r.id =:tm.Contact_Resource__r.id];
        Decimal sum=0;
        for (Team_Member__c teamMem:tms){
            sum = sum + teamMem.Allocation_to_Team__c;
            if(sum>100){
                tm.addError('More than 100%');
            }
            
        }
    }
}
Hello as we all know that customer validation excute first and then before trigger . 
so I write a trigger to show error message if description is null
trigger updatecontact on contact( before trigger)
for(contact con: trigger new)
If(con.description == null)
Con.adderror(' message from trigger i.e contact is null')
 
And wrote a custom validation for the same thing
When I try to save the code its showing message from before trigger not from custom validation .

Why so . Please help I'm confused
 
 
i want to change owner through trigger on new record when industry = agriculture else shows error

Please anyone give me code for this
i have tried this much

trigger changeownerTrigger on Account (before insert) {

    for(Account ac: trigger.new){
        
        if(ac.Industry=='Agriculture')
            
    }
}