• Grazitti Interactive
  • NEWBIE
  • 264 Points
  • Member since 2013

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

Hi 

 

My issue is my Descriptive field is getting updated from a trigger in this format

Descriptive ID

Graphic Designer-International-General-Regular-0.75
 

Required format 

 

Descriptive ID  G-I-G-R-0.75

 

Please modify this code

 

descString = '';
descString += posToUpdate.Name != NULL ? posToUpdate.Name : '' ;
descString += dbPosition.VanaHCM__Position_Title__c != NULL ? '-'+dbPosition.VanaHCM__Position_Title__c: '' ;
descString += dbPosition.Hire_Type__c != NULL ? '-'+dbPosition.Hire_Type__c: '' ;
descString += posToUpdate.Funding_Type__c != NULL ? '-'+posToUpdate.Funding_Type__c: '' ;
descString += posToUpdate.Funding_Status__c != NULL ? '-'+posToUpdate.Funding_Status__c: '' ;
descString += posToUpdate.Position_FTE__c != NULL ? '-'+posToUpdate.Position_FTE__c: '' ;
if(descString.startsWith('-') && descString.length() >0){
descString = descString.substring(1);
}
posToUpdate.Descriptive_ID__c = descString;

  • October 23, 2013
  • Like
  • 0

Hi All,

          I trying to download program for custom object , we the user click the "Download" custom button it should download all the records from the custom object. This download file should in text format(.txt) with fixed width. Kindly anyone tell ideas and links for this. Thanks in advance

HI All ,

In batch class they have wriiten query like this

 

 global Database.querylocator start(Database.BatchableContext BC)
    {
        query='select id,IsArchived from ContentDocument where IsArchived=true ALL ROWS';
        return Database.getQueryLocator(query);
    }

But while executing from test class it will not return any records, So it will not execute "execute" method from batch class.

Please refer the below test class :

 

 Test.startTest();
            string before = 'Testing base 64 encode';             
            Blob beforeblob = Blob.valueOf(before);
            ContentVersion cv = new ContentVersion();
            cv.title = 'test content trigger';       
            cv.PathOnClient ='test';            
            cv.VersionData =beforeblob;           
            insert cv;                                                  
            
            ContentVersion testContent = [SELECT id, ContentDocumentId FROM ContentVersion where Id = :cv.Id];
            ContentWorkspace testWorkspace = [SELECT Id FROM ContentWorkspace limit 1];
            ContentWorkspaceDoc newWorkspaceDoc =new ContentWorkspaceDoc();
            newWorkspaceDoc.ContentWorkspaceId = testWorkspace.Id;
            newWorkspaceDoc.ContentDocumentId = testContent.ContentDocumentId;
            insert newWorkspaceDoc;
            
            ContentDocument cd = [select id, IsArchived from contentdocument where id=:testcontent.contentdocumentid limit 1];
            cd.IsArchived = true;
                     
            //update cd;
           System.debug('Cd Size ' + cd);
            System.debug('DDDDDDD ' + cd.IsArchived);
           
          
                BatchContentArchived objDocs = new BatchContentArchived();
                objDocs.query='select id,IsArchived from ContentDocument where IsArchived=false limit 2 ALL ROWS';
                /*objDocs.query='select id,title from ContentVersion limit 2 ALL ROWS';*/
                ID batchprocessid = Database.executeBatch(objDocs);
                
             
            Test.stopTest();

 

-------------------------------------------------------------------------------------------------------------------------------------

 

Can anyone please let me know how to cover the code ????

 

Thanks in Advance ....

Hi all,

I am having two custom objects which is named as custom_object1__c,custom_object2__c.Now i want to write the validation rule on custom_object1__c saying that "custom_object1__c.transactiondate  should be always greater than custom_object2__c.somedate".

 

I have written the validation rule like this.

transactiondate__c < custom_object2__c.somedate__c

 

I am getting the following error.

Error: Syntax error. Found 'custom_object2__c'

 

how can i write the rule for this scenario.

please help me to solve this.

 

thanks,

Arun.

this is my code i have done to create an case record whenever the booking record is created

But the case record is not created wen i create a booking record 

can anyone help mw out from this???

 

trigger CreatingCase on Bookings__c (after insert , after update) 
{
    set<id> BookingSet = new set<id>();
    for(integer i=0;i<trigger.size;i++)
        {
            BookingSet.add(trigger.new[i].id);
        }    
    list<case> CaseList = new list<case>();
    for(integer i=0;i<trigger.size;i++)
        {
            case caseinstance = new case();
            caseinstance.Vehicles__c = trigger.new[i].Vehicle__c;
            caseinstance.Zone_Value__c = trigger.new[i].Zone__c;
            caseinstance.Booking_No__c = trigger.new[i].name;
            CaseList.add(caseinstance);
        }
     insert CaseList;
}

  • September 13, 2013
  • Like
  • 0

Hi,

For some odd reason, I'm unable to pass the parameter using APEX:ACTIONFUNCTION.

 

Code Snippet:

 

VF PAGE:

<apex:page standardController="Service_Catalogue__c" extensions="serviceCatalogueCtrl">

<script>
function fnChange(a)
{
alert('Hello Param'+a);
testJs(a);
alert(a);
}

<apex:form>

<apex:actionFunction name="testJs" action="{!testJs}" rerender="" >
<apex:param value="" id="y" assignTo="{!subCategory}" />
</apex:actionFunction>

 

<apex:inputField value="{!Service_Catalogue__c.Category__c}"/>
<apex:inputField value="{!Service_Catalogue__c.SubCategory__c}" onchange="fnChange(this.value);" />

</apex:form>

</apex:page>

 

APEX CLASS:

public class serviceCatalogueCtrl {

 public string subCategory{get;set;}

public serviceCatalogueCtrl(ApexPages.StandardController controller) {
}

public PageReference testJs()
{
system.debug('Hello subCategory @@'+subCategory);

return null;
}

}

 

 

Service catalogue is my custom object which has 2 picklist fields category and subcategory.

I want to pass the value that I selected in subcategory field and pass it to my controller for further processing.

 

But for some reason subcategory value is not getting set while trying to set in actionfunction.

 

It looks simple but I'm missing something.

Many thanks in advance for your help:)

Thank You!

 

Hi all,

 

I have a weird problem where I am querying from my Sandbox evnironment the following using the LIKE operation using the following snippet of code:

 

string s = '%__c'; 
list<CaseHistory> hist = new list<CaseHistory>();
hist = [Select Field From CaseHistory Where Field like :s Order by Field Limit 10];

 I get a erro as follows:

 

Compile error at line 3 column 5
invalid operator on id field

 

I have no idean where I am going wrong but I seem to be following the query syntax correctly?

Is there a bug in Sandbox query with the LIKE operator?

 

Thanks for your help!

  • September 12, 2013
  • Like
  • 0

Hello, I'm having a strange issue where I'm getting too many code statements: 20001 on this trigger:

 


trigger UpdateLeadPass on Lead (before update) {
    
    Lead[] lead = Trigger.new;
    Lead[] oldLead = Trigger.old;

    if(Trigger.isUpdate) {    
        if (lead != null && oldLead != null){
            for(Lead leadPointer : lead) {
                for (Lead oldPointer : oldLead) {
                    if (leadPointer.bdr_to_sr__c == True){
                        leadPointer.bdr_to_sr_rep__c = UserInfo.getUserId();
                        leadPointer.Transfer_Date__c = System.Now();
                    } else if (oldPointer.bdr_to_sr__c == True && leadPointer.bdr_to_sr__c == false) {
                        leadPointer.bdr_to_sr_rep__c = null;
                    }
                    if (leadPointer.bdr_to_ae__c == True){
                        leadPointer.bdr_to_ae_rep__c = UserInfo.getUserId();
                        leadPointer.Transfer_Date__c = System.Now();
                    } else if (oldPointer.bdr_to_ae__c == True && leadPointer.bdr_to_ae__c == false) {
                        leadPointer.bdr_to_ae_rep__c = null;
                    }
                    if (leadPointer.bdr_to_reseller__c == True){
                        leadPointer.bdr_to_reseller_rep__c = UserInfo.getUserId();
                        leadPointer.Transfer_Date__c = System.Now();
                    } else if (oldPointer.bdr_to_reseller__c == True && leadPointer.bdr_to_reseller__c == false) {
                        leadPointer.bdr_to_reseller_rep__c = null;
                    }
                    if (leadPointer.sr_to_ae__c == True){
                        leadPointer.sr_to_ae_rep__c = UserInfo.getUserId();
                        leadPointer.Transfer_Date__c = System.Now();
                    } else if (oldPointer.sr_to_ae__c == True && leadPointer.sr_to_ae__c == false) {
                        leadPointer.sr_to_ae_rep__c = null;
                    }
                    if (leadPointer.sr_to_reseller__c == True){
                        leadPointer.sr_to_reseller_rep__c = UserInfo.getUserId();
                        leadPointer.Transfer_Date__c = System.Now();
                    } else if (oldPointer.sr_to_reseller__c == True && leadPointer.sr_to_reseller__c == false){
                        leadPointer.sr_to_reseller_rep__c = null;
                    }
                    if (leadPointer.ae_to_reseller__c == True){
                        leadPointer.ae_to_reseller_rep__c = UserInfo.getUserId();
                        leadPointer.Transfer_Date__c = System.Now();
                    } else if (oldPointer.ae_to_reseller__c == True && leadPointer.sr_to_reseller__c == false) {
                        leadPointer.ae_to_reseller_rep__c = null;
                    }
                }
            }    
        }
    }
}

 

 

The Trigger is very simple so I don't understand where this is happening? Strange thing as well, if I load let's say 350 leads the first 200 will get this error and the next 150 will load fine. If I reduce that too 300 leads loaded the first 200 still error and the next 100 make it in just fine.

 

Any help is very appreciated thank you!

 

-Jon

  • September 10, 2013
  • Like
  • 0

Hi, 

 

  I need a  help in adding opportunity name inside a function. Below is the function which is actually a scheduler which runs every day.

 

global class TestScheduledApexFromTestMethod implements Schedulable {

 //public static String CRON_EXP = '0 0 0 3 9 ? 2013';
   
   global void execute(SchedulableContext ctx) 
   {
      
     List<IB_SUPPORT_CONTRACTS_MV__c> IBV =  [ SELECT  CONTRACT_NUMBER__c, SERIAL_NUMBER__c, SERVICE_END_DATE__c   
                                    FROM   IB_SUPPORT_CONTRACTS_MV__c 
                                    WHERE CONTRACT_NUMBER__c = 'MERU-7203' AND SERIAL_NUMBER__c != null  ];   
  
      List<Opportunity> lstOppInsert = new List<Opportunity>(); //List of opportunities to insert 
      
      for (IB_SUPPORT_CONTRACTS_MV__c ib : IBV  )
          
         {  
         
               //Single opp object to add in list
              Opportunity op = new Opportunity(
              name = ib.SERIAL_NUMBER__c,                  
              OwnerId = '00560000001vfE5AAI',
              Secondary_Owner__c = '00560000001vfE5AAI',
              discount_program__c = 'DEALREG',
              Abbv_Discount_Program__c = 'DR',
              CloseDate = Date.today(),
              StageName = 'Discovery', 
              Primary_Competitor__c = 'HP',
              type = 'Existing Customer',
              Government_Contract__c = 'None',
              leadsource = 'Deal Registration',
              Partner_Driven__c = 'yes',
              primary_distributor__c = '0016000000LmI0oAAF',
              primary_reseller__c = '0016000000N141hAAB',
              channel_source__c = 'Distributor',
              K_12__c  = 'No',
              Renewal_Opportunity__c = 'No',
              Renewal_Incumbant_Reseller__c = 'No',
              Renewal_K_12__c = 'No',    
              DEALREG_SEND_QUOTE__c = 'Do Not Send',
              RENEWAL_SEND_QUOTE__c = 'Do Not Send',  
              accountid = '001g0000004vLxmAAE',        
              Partner_Initiated_International__c = 'No',       
              Partner_Led__c = 'No');                         
              lstOppInsert.add(op); 
          }   

           //insert op;
            if(lstOppInsert.size()>0){
                Insert lstOppInsert; //This will insert all opportunities at once.
            }
             sendmail();
        }   
        
    public void sendmail()
     {
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        string [] toaddress= New string[]{'sudhirn@merunetworks.com','rberi@merunetworks.com','hradhakrishnan@merunetworks.com'};
        email.setSubject('Contracts Converted to Opportunities');
        email.setPlainTextBody('Testing Apex Scheduler-Body');  // I want to include all the opportunity name which got created.
        email.setToAddresses(toaddress);
        Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});
        }
}

 

 In the above code inside sendmail() body i want to include all the opportunity which got created. Please suggest me how to add. 

 

Thanks
Sudhir

 

HI,

 

I am getting in this format from integration

 

2013-10-22T00:00:00-07:00

 

Need to convert  like 10/30/2011( MM/DD/YY)

 

Thanks in Advance

Hi 

 

My issue is my Descriptive field is getting updated from a trigger in this format

Descriptive ID

Graphic Designer-International-General-Regular-0.75
 

Required format 

 

Descriptive ID  G-I-G-R-0.75

 

Please modify this code

 

descString = '';
descString += posToUpdate.Name != NULL ? posToUpdate.Name : '' ;
descString += dbPosition.VanaHCM__Position_Title__c != NULL ? '-'+dbPosition.VanaHCM__Position_Title__c: '' ;
descString += dbPosition.Hire_Type__c != NULL ? '-'+dbPosition.Hire_Type__c: '' ;
descString += posToUpdate.Funding_Type__c != NULL ? '-'+posToUpdate.Funding_Type__c: '' ;
descString += posToUpdate.Funding_Status__c != NULL ? '-'+posToUpdate.Funding_Status__c: '' ;
descString += posToUpdate.Position_FTE__c != NULL ? '-'+posToUpdate.Position_FTE__c: '' ;
if(descString.startsWith('-') && descString.length() >0){
descString = descString.substring(1);
}
posToUpdate.Descriptive_ID__c = descString;

  • October 23, 2013
  • Like
  • 0

Hi,

I want to display a pop up window on click of a button.

I am using this code but this is displaying a proper Salesforce page with all tabs and sidebars. What should i change in this code to remove sidebars and tabs on the popup window. 

 

window.open(url,"Homepage","resizable=yes,status=yes,scrollbars=no,width=800,height=400,target=_blank");

 

Thanks

Yuvika

  • October 15, 2013
  • Like
  • 0

I have created one custom object & there is one picklist Opt with two option- Yes & No.

 

My requirement is that I want to display  “I like primary interest specifically secondary interest” if user selects ‘YES’ option in picklist.

 

Hi,

Pls let me know where did i make a mistake. its urgent.

     when i click on send email button it is showing error at multiselect picklist field

Error: j_id0:j_id1:j_id3:Distribution_List: An error occurred when processing your submitted information.

 

 public class sendingemail {
Public String subject{get;set;}
Public String body{get;set;}
Public List<Contact> contactlist;
    public sendingemail(ApexPages.StandardController controller) {
//contact = [select name, lastName, email,Distribution_List__c, Opt_out_Email__c,recordtype.name from Contact where id = :ApexPages.currentPage().getParameters().get('id')];
    }
    public List<Contact> getContact() {
return contactlist;
}
    public PageReference send() {
    contactlist =[select lastName, email,Distribution_List__c, Opt_out_Email__c,recordtype.name from Contact where Opt_out_Email__c = false and Distribution_List__c='DL1;DL2'];
    // Define the email
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
// Sets the paramaters of the email
String addresses;
if (Contactlist[0].Email != null)
{
addresses = Contactlist[0].Email;
// Loop through the whole list of contacts and their emails
for (Integer i = 1; i < Contactlist.size(); i++)
{
if (Contactlist[i].Email != null)
{
addresses += ':' + Contactlist[i].Email;
}
}
}
String[] toAddresses = addresses.split(':', 0);
email.setSubject( subject );
email.setToAddresses(toAddresses);
email.setPlainTextBody( body );
// Sends the email
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
return null;
    }

}

this is my page.

<apex:page StandardController="Contact" extensions="sendingemail">
<apex:pageBlock title="Send an Email to Your
{!Contact.name}">
<p>Please choose the distribution List</p>
<br />
<apex:form >
<br /><br />
<apex:outputLabel value="Distribution_Lists" for="Distribution_List"/>:<br />
<apex:inputfield value="{!Contact.Distribution_List__c}" />
<br /><br />
<apex:outputLabel value="Subject" for="Subject"/>:<br />
<apex:inputText value="{!subject}" id="Subject" maxlength="80"/>
<br /><br />
<apex:outputLabel value="Body" for="Body"/>:<br />
<apex:inputTextarea value="{!body}" id="Body" rows="10" cols="80"/>
<br /><br />

<br />
<apex:commandButton value="Send Email" action="{!send}" />
</apex:form>

 </apex:pageBlock>
</apex:page>

 

 

Regards

Sri

Hi All,

 

I m getting below error while updating Opportunity.

 

System.QueryException: null: 

 

When i query in debug log its works fine, but when i run the Query in class is gives me above exception.

 

Select SplitPercentage, SplitOwnerId, SplitNote, SplitAmount, OpportunityId, Id From OpportunitySplit where OpportunityId!=null and OpportunityId IN('006Z0000007XSSDSSD') limit 50000

 

So any one has any idea where i am going wrong.

 

Thanks

Shailu

 

  • October 01, 2013
  • Like
  • 0

 

Hi,

 

I have a requirement object and in that i have a status picklist which contains 4 status.

If the status is reopen, then the no.of resumes in the requirement object should be 0. And if the no.of resumes is 0, then an error message should be thrown like "enter the no. of resumes".

I am updating few other fields based on the reopen status in a trigger. So I am updating no.of resumes to 0 in that trigger and created a validation rule in requirement object like

if (no.of resumes == 0, true, false)
error message : enter the no.of resumes.


But the error message is throwing whenever i have mentioned no.of resumes greater than 0 (i.e 1).

 

 

Kindly advice.

Hi All,

          I trying to download program for custom object , we the user click the "Download" custom button it should download all the records from the custom object. This download file should in text format(.txt) with fixed width. Kindly anyone tell ideas and links for this. Thanks in advance

Hi,

 

I am writing a trigger to fetch the recently updated document from the Notes and Attachement Object. This document would appear as a link.

May someone help me with how to fetch the link of the document?

Can someone please point me in the right direction?hanks.

 

Error Message: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)
Error System Trace: Class.HelperClass.newEval: line 982, column 1 Trigger.triggername: line 36, column 1

 

trigger triggername on Object__c (after insert, after update) {

 if(trigger.isInsert){
        List<Object__c> evaluations = [Select Id From Object__c];
    
        Map<Id, List<Id>> junk = new Map<Id, List<Id>>();
        for (Object__c obj : evaluations) {
        
            junk.put(obj.Id, new List<Id>());   
        }

        for (Employee_Object__c empobs : Trigger.new) {
            if (junk.containsKey(empobs.Object__c)) {
                junk.get(empobs.Object__c).add(empobs.Id);            
            }       
        }
    
    
        
        HelperClass.newEval(trigger.new); // line36        
    }
 ......
 
}

 

public without sharing class HelperClass {
  public static void newEval(list<Object__c> newEV){
        try {
            //Get List of Employee IDs, OS
            set<id> empIDs = new set<id>();
            set<id> cnIds = new set<id>();
            for(Object__c ev: newEV){
                empIDs.add(ev.Employee__c);
                cnIDs.add(ev.Group_Leader_Id__c);
            }
            list<Employee__c> emps = [select id,Manager_Id__c,Group_Leader_Id__c,SC_ID__c from Employee__c where id in:empIDs];
            map<id,Employee__c> mp_emps = new map<id,Employee__c>(emps);
            
            //Get User IDs from Contact         
            for(Employee__c e: emps){
                cnIds.add(e.Group_Leader_Id__c);
                cnIds.add(e.SC_ID__c);
            }
            
            list<user> usr = [select id, contactID from user where contactID in: cnIDs]; // line982            map<id,id> usrIDs = new map<id,id>(); //first ID is the Contact
            for(user u:usr){
                usrIDs.put(u.contactID,u.id);
            }
   
   
   .......

}

 

 


 

  • September 25, 2013
  • Like
  • 0

HI All ,

In batch class they have wriiten query like this

 

 global Database.querylocator start(Database.BatchableContext BC)
    {
        query='select id,IsArchived from ContentDocument where IsArchived=true ALL ROWS';
        return Database.getQueryLocator(query);
    }

But while executing from test class it will not return any records, So it will not execute "execute" method from batch class.

Please refer the below test class :

 

 Test.startTest();
            string before = 'Testing base 64 encode';             
            Blob beforeblob = Blob.valueOf(before);
            ContentVersion cv = new ContentVersion();
            cv.title = 'test content trigger';       
            cv.PathOnClient ='test';            
            cv.VersionData =beforeblob;           
            insert cv;                                                  
            
            ContentVersion testContent = [SELECT id, ContentDocumentId FROM ContentVersion where Id = :cv.Id];
            ContentWorkspace testWorkspace = [SELECT Id FROM ContentWorkspace limit 1];
            ContentWorkspaceDoc newWorkspaceDoc =new ContentWorkspaceDoc();
            newWorkspaceDoc.ContentWorkspaceId = testWorkspace.Id;
            newWorkspaceDoc.ContentDocumentId = testContent.ContentDocumentId;
            insert newWorkspaceDoc;
            
            ContentDocument cd = [select id, IsArchived from contentdocument where id=:testcontent.contentdocumentid limit 1];
            cd.IsArchived = true;
                     
            //update cd;
           System.debug('Cd Size ' + cd);
            System.debug('DDDDDDD ' + cd.IsArchived);
           
          
                BatchContentArchived objDocs = new BatchContentArchived();
                objDocs.query='select id,IsArchived from ContentDocument where IsArchived=false limit 2 ALL ROWS';
                /*objDocs.query='select id,title from ContentVersion limit 2 ALL ROWS';*/
                ID batchprocessid = Database.executeBatch(objDocs);
                
             
            Test.stopTest();

 

-------------------------------------------------------------------------------------------------------------------------------------

 

Can anyone please let me know how to cover the code ????

 

Thanks in Advance ....

Hi all,

I am having two custom objects which is named as custom_object1__c,custom_object2__c.Now i want to write the validation rule on custom_object1__c saying that "custom_object1__c.transactiondate  should be always greater than custom_object2__c.somedate".

 

I have written the validation rule like this.

transactiondate__c < custom_object2__c.somedate__c

 

I am getting the following error.

Error: Syntax error. Found 'custom_object2__c'

 

how can i write the rule for this scenario.

please help me to solve this.

 

thanks,

Arun.

Hi,

 

I have to write a trigger to show error message when quantity more than actual quantity value.

 

i have 2 objects callup order(child) and purchase order(parent) both have lookup,

in purchase order a filed called quatition qunatiyty ,here i will give my qty.

so for one purchase order i can i create any number of call up order,

for example i given qty 200 in purchase order,

now when i goto create call up order it should not allow me to create more than 200,

example i created one call up order with qty 120,i created anther call up order with 70,and when i try to craete anther call up order with qty 30 i need to show error.

 

can any one tell me how can i do this

this my trigger
 

 

 

trigger total_calluo_order_qty on Call_Up_Order__c (before insert,before update) {

set<id> saleid=new set<id>();
List<Purchase_Order__c> ToUpdate = new List<Purchase_Order__c>();

if(trigger.isInsert || trigger.isUpdate){
for(Call_Up_Order__c c: trigger.new){
      saleid.add(c.Sale_Confirmation_Order__c);
    }
}

if(trigger.isDelete){
    for(Call_Up_Order__c c: trigger.new){
      saleid.add(c.Sale_Confirmation_Order__c);
    }
  }

map<id,double> Map = new map<id,double>();
for(AggregateResult q : [select sum(Call_Up_Quantity__c)totalcallup,Sale_Confirmation_Order__c from Call_Up_Order__c where Sale_Confirmation_Order__c in:saleid group by Sale_Confirmation_Order__c])
{
      Map.put((Id)q.get('Sale_Confirmation_Order__c'),(Double)q.get('totalcallup'));
  }


   for(Purchase_Order__c p:[select id,Total_call_up_order_Quantity__c from Purchase_Order__c where id in:saleid])
   {
    Double PaymentSum = Map.get(p.Id);
    p.Total_call_up_order_Quantity__c=PaymentSum ;
    ToUpdate.add(p);
    }         
         update ToUpdate;
             
         
         for(Call_Up_Order__c cup:[select id,Quote_Quantity__c,Balance_Qty__c,Call_Up_Quantity__c,Total_call_up_order_Quantity__c from Call_Up_Order__c  where id in:trigger.new])
         {
         if(cup.Total_call_up_order_Quantity__c >= cup.Quote_Quantity__c)        
         {
         cup.addError('please check all call up order quantity was excedded');
         }         
         }
         
}

 

 

regards

venkatesh.

 

 

 

Hi Team,

 

I am getting the error when i try to save my batch class:

 

Here is the code:

 

global class UpdateRequestAccessForDetails implements Database.Batchable<SObject>
{
  Public String Query='Select Id,status__c, No_Access_Granted_for_30_Days__c,test__c From Request_Access_Details__c where Status__c!='Submitted'';    
    global  Database.QueryLocator Start(Database.BatchableContext BC)
    {
      return Database.getQueryLocator(query);
   
    }
    global void Execute(Database.BatchableContext BC,List<Request_Access_Details__c> rads)
    {
    try{
      List<Request_Access_Details__c> listRad =new List<Request_Access_Details__c>();
      for(Request_Access_Details__c objRad:rads)
      {
            if(objRad.Status__c =='Submitted')
                {
             objRad.No_Access_Granted_for_30_Days__c==true;
                listRad.add(objRad);
           }
 
        }
        if(listRad!=null && listRad.size()>0)
        
       // list<Database.DeleteResult> sr = Database.delete(listAcc,false);  
    update listRad;
    
}catch(Exception e){}
    }
    global void finish(Database.BatchableContext BC)
    {
    }
    
}

 

When i try save the above code, i am getting the following error:

 

Error: Compile Error: unexpected token: 'global class UpdateRequestAccessForDetails implements Database.Batchable' at line 1 column 0

 

 

Please let me know what is the cause??

 

Thanks,

Anil

Hi,

 

i AM GETTING THE BELOW ERROR when trying to save a record.

 

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger GroupCreation caused an unexpected exception, contact your administrator: GroupCreation: execution of AfterDelete caused by: System.DmlException: Delete failed. First exception on row 0 with id 00Gg0000000RxOYEA0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Group, original object: IA_Team__c: []: Trigger.GroupCreation: line 83, column 1". 

Trigger GroupCreation on IA_Team__c (after insert,after update,after delete)
{
    Group grp = new Group();
    list<Group> gplist=new list<Group>();
    list<IA_Team__c> ialist=new list<IA_Team__c>();
    if(trigger.isinsert)
    {
        set<id> memids = new set<id>();
        for(IA_Team__c ev:Trigger.New)
        memids.add(ev.id);
        for(IA_Team__c ia:[select Name,Public_Group_Name__c from IA_Team__c where id in:memids])
        {
            grp.Name = ia.Name;
            System.debug('@@@@@@@@@@@@@'+ grp.id);
            grp.DeveloperName = ia.Public_Group_Name__c;
            ia.Team_Linked_To_Group__c=True;
            ia.Unique_Group_Id__c=grp.Id;
            ialist.add(ia);
            gplist.add(grp);
        }
        if(!gplist.isempty())
        {
            insert gplist;
            update  ialist;
        }
    }
  
   if(trigger.isdelete)
	 {
        set<string> memname = new set<string>();
        Map<string,string> mgroups2 = New Map<string,string>();
        for(IA_Team__c ev:Trigger.Old)
        {
            memname.add(ev.Name);
            mgroups2.put(ev.Name,ev.Name);
        }
        list<Group> resultlist=new list<Group >([select Name,DeveloperName from Group where Name in:memname]);
         list<Group> uplist=new list<Group>();
        for (Integer i = 0; i < Trigger.oldMap.size(); i++)
        {
            if(mgroups2.containsKey(Trigger.old[i].Name))
            {
               mgroups2.put(Trigger.old[i].Name,Trigger.oldMap[i].Name);
            }
        }
        for (Integer i = 0; i < resultlist.size(); i++)
        {
            if(mgroups2.containsKey(resultlist[i].Name))
            {
                resultlist[i].Name=mgroups2.get(resultlist[i].Name);
                resultlist[i].DeveloperName=mgroups2.get(resultlist[i].Name);
                uplist.add(resultlist[i]);
            }
        }
       delete uplist;
	 }
    }

 Thanks in Advance.

  • September 16, 2013
  • Like
  • 0

Can any body tell me what are the exact differences between pageblock table and data table..?

  • September 15, 2013
  • Like
  • 0

Hello,

 

I am very new to that forum, so at the beginning I want to say "hello" to everyone!

 

I am new to APEX and I face the problem which APEX trigger seems to be a solution. I would need a trigger in Salesforce which would update the field located in Users object (standard object) using the value from Holidays Remaining field from Staff object (custom object). In other words, what is populated in Holidays Remaining in Staff it should be copied to the field called holidays Remaining in the Users level. Could anyone help me with that please?

Hi,

We have installed app WikiOrgChart in our Sandbox org, on Account detail page, there is a link ' View In The Org Chart' , on click on this link, it redirects to following url and page never loads in some cases.
Note that this page (i.e. Corresponds to an account record ) loads successfully for one user and does not load for another user and also both users have the same profile and same sharing settings.

https://salesforce.wikiorgcharts.com/dispach.php?wikilocation=salesforce/chart/accountId_001Z000000c3dDtIAI&sfapisessionid=00DZ0000001C5S9!AQMAQNALPzip8Cej5lvYyq4xPN5x44YE2O3IY85.d.plHba7DZlcXRPOASt1jWTIgT5LBadmtAXV_fbPaMFFp5KtFt2Yl4.3&sfapipartnerserverurl=https://c.cs11.visual.force.com/services/Soap/u/20.0/00DZ0000001C5S9

 

Please respond as soon as possible, its urgent.

 

Thanks

Ayub