• Abhi Charles
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 0
    Replies

Hi,

 

I am looking for a code where i can get the list or available user to whom i can assign task.

For example i have a task "Ticket" to be assigned so need to get list of all the user who are available at that time according to availability on the user's calendar.

Any help is highly appreciated.

 

Thanks,

AKC

 

Hi i am getting this error in my test class my code is::::::

 

@isTest (seeAllData = true)
private class testneedAccApproval
{
    static testMethod void myUnitTestON24PBA_Recall()
    {     
        test.startTest();

        Profile p = [SELECT Id FROM Profile WHERE Name = 'System Administrator'];
        User u1 = new User();
        u1.Email = 'email1@email.com';
        u1.Alias = 'Alias2';
        u1.TimeZoneSidKey = 'America/New_York';
        u1.LocaleSidKey = 'ca';
        u1.EmailEncodingKey = 'UTF-8';
        u1.ProfileId = p.id;
        u1.LanguageLocaleKey = 'en_US';
        u1.FirstName = 'firstname1';
        u1.LastName = 'lastname1';
        u1.username= 'username1@first.com';
        insert u1;

        User u2 = new User();
        u2.Email = 'email2@email.com';
        u2.Alias = 'Alias3';
        u2.TimeZoneSidKey = 'America/New_York';
        u2.LocaleSidKey = 'ca';
        u2.EmailEncodingKey = 'UTF-8';
        u2.ProfileId = p.id;
        u2.LanguageLocaleKey = 'en_US';
        u2.FirstName = 'firstname2';
        u2.LastName = 'lastname2';
        u2.username= 'username2@first.com';
        insert u2;

        Product2 p1 = new product2(name='unittest');
        insert p1;

        Pricebook2 stdPb = [select Id from Pricebook2 where isStandard=true limit 1];
        insert new PricebookEntry(pricebook2id = stdPb.id, product2id = p1.id,unitprice=1.0, isActive=true);

        Pricebook2 pb = new pricebook2(name='unittest');
        insert pb;

        PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p1.id,unitprice=20000.0, isActive=true);
        insert pbe;

        Account AcntRec = new Account(name = 'Acc', Type = 'Customer', Industry = 'Automotive',BillingCity = 'Avon', BillingCountry = 'USA', BillingPostalCode = '14414', BillingState = 'New York', BillingStreet = 'Wall St');
        insert AcntRec;
        
        Opportunity o = new Opportunity (pricebook2id = pb.id, Name = 'OwnerRoleTest #1',AccountId = AcntRec.Id, Stagename='Open', Closedate=Date.newInstance(2010,02,02),Country__c = 'USA');
        insert o;

        Opportunity op = [select id from Opportunity where Name like 'OwnerRoleTest #1'];
        Pricebook2 pb1 = [select id from Pricebook2 where Name like 'unittest'];
        PricebookEntry pbe1 = [select id from PricebookEntry where pricebook2id=:pb1.id];

        ON24_Contract__c c = new ON24_Contract__c(name = 'testopty', Client_Name__c = AcntRec.Id, Opportunity__c=o.Id, Sales_Representative_1__c = u1.Id, Sales_Representative_2__c = u2.Id, Status__c = 'Draft', Agreement_Type__c = 'Services Agreement', Region__c='EMEA');
        insert c;
        
        AcntRec.BillingCity = '';
        AcntRec.BillingCountry = '';
        AcntRec.BillingPostalCode = '';
        AcntRec.BillingState = '';
        AcntRec.BillingStreet = '';
        update AcntRec;
        
        Contract_Line_Item__c cli = new Contract_Line_Item__c(ON24_Contract__c = c.Id, CurrencyIsoCode = 'USD', Validation_Pool__c = 'Yes', Quantity__c=2, Sales_Price__c = 15000, Product__c = p1.Id);
        insert cli;
        
        update c;
        
        approvalNeedAccountAdd vde = new approvalNeedAccountAdd();
        Pagereference pr = vde.closePopup();
        vde.isNotApproved = true;
        vde.displayPopUp = true;
        vde.displayApprovalPopUp = false;

    }
    static testMethod void myUnitTestON24PBA_Recall1()
    {     
 

        Profile p = [SELECT Id FROM Profile WHERE Name = 'System Administrator'];
        User u1 = new User();
        u1.Email = 'email1@email.com';
        u1.Alias = 'Alias2';
        u1.TimeZoneSidKey = 'America/New_York';
        u1.LocaleSidKey = 'ca';
        u1.EmailEncodingKey = 'UTF-8';
        u1.ProfileId = p.id;
        u1.LanguageLocaleKey = 'en_US';
        u1.FirstName = 'firstname1';
        u1.LastName = 'lastname1';
        u1.username= 'username1@first.com';
        insert u1;

        User u2 = new User();
        u2.Email = 'email2@email.com';
        u2.Alias = 'Alias3';
        u2.TimeZoneSidKey = 'America/New_York';
        u2.LocaleSidKey = 'ca';
        u2.EmailEncodingKey = 'UTF-8';
        u2.ProfileId = p.id;
        u2.LanguageLocaleKey = 'en_US';
        u2.FirstName = 'firstname2';
        u2.LastName = 'lastname2';
        u2.username= 'username2@first.com';
        insert u2;

        Product2 p1 = new product2(name='unittest');
        insert p1;

        Pricebook2 stdPb = [select Id from Pricebook2 where isStandard=true limit 1];
        insert new PricebookEntry(pricebook2id = stdPb.id, product2id = p1.id,unitprice=1.0, isActive=true);

        Pricebook2 pb = new pricebook2(name='unittest');
        insert pb;

        PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p1.id,unitprice=20000.0, isActive=true);
        insert pbe;

        Account AcntRec = new Account(name = 'Acc', Type = 'Customer', Industry = 'Automotive',BillingCity = 'Avon', BillingCountry = 'USA', BillingPostalCode = '14414', BillingState = 'New York', BillingStreet = 'Wall St');
        insert AcntRec;
        
         Contact con = new Contact(AccountId = AcntRec.Id, LastName = 'Charles', LeadSource = 'Web Services');
        insert con;

        Opportunity o = new Opportunity (pricebook2id = pb.id, Name = 'OwnerRoleTest #1',AccountId = AcntRec.Id, Stagename='Open', Closedate=Date.newInstance(2010,02,02),Country__c = 'USA');
        insert o;

        Opportunity op = [select id from Opportunity where Name like 'OwnerRoleTest #1'];
        Pricebook2 pb1 = [select id from Pricebook2 where Name like 'unittest'];
        PricebookEntry pbe1 = [select id from PricebookEntry where pricebook2id=:pb1.id];
        
        ON24_Contract__c c = new ON24_Contract__c(name = 'testopty1', Client_Name__c = AcntRec.Id, Opportunity__c=o.Id, Sales_Representative_1__c = u1.Id, Sales_Representative_2__c = u2.Id, Status__c = 'Draft', Agreement_Type__c = 'Services Agreement', Region__c='EMEA',Client_Type__c='Full Service',Vertical__c='Channel',Expiration_Date__c=Date.newInstance(2010,02,02),Effective_Date__c=Date.newInstance(2010,02,02),   Billing_Terms__c='Custom',Payment_Terms__c='Net 45');
        insert c;

        Contract_Line_Item__c cli = new Contract_Line_Item__c(ON24_Contract__c = c.Id, CurrencyIsoCode = 'USD', Validation_Pool__c = 'Yes', Quantity__c=2, Sales_Price__c = 15000, Product__c = p1.Id);
        insert cli;
        
        update c;
        
        approvalNeedAccountAdd vde = new approvalNeedAccountAdd();

             test.startTest();
            Pagereference pr = vde.submitAndProcessApprovalRequest() ;
            
            Approval__c AP1 = new Approval__c(Contract__c = c.Id);
            insert AP1;
            Approval__c AP = [select id from Approval__c where Contract__r.Status__c = 'Draft'];    
            Approval.ProcessSubmitRequest req1 =  new Approval.ProcessSubmitRequest();
            req1.setComments('Test : Submitting request for approval.');
            req1.setObjectId(c.id);
            req1.setNextApproverIds(new Id[] {UserInfo.getUserId()});
            Approval.ProcessResult result1 = Approval.process(req1);      
            System.assert(result1.isSuccess());
            System.assertEquals('Pending', result1.getInstanceStatus(), 'Instance Status'+result1.getInstanceStatus());
            List<Id> newWorkItemIds = result1.getNewWorkitemIds();
            Approval.ProcessWorkitemRequest req2 = new Approval.ProcessWorkitemRequest();
            req2.setComments('Approving request.');
            req2.setAction('Approve');
            req2.setNextApproverIds(new Id[] {UserInfo.getUserId()});
            req2.setWorkitemId(newWorkItemIds.get(0));
            Approval.ProcessResult result2 =  Approval.process(req2);
            
            vde.isNotApproved = false;
            vde.displayPopUp = false;
            vde.displayApprovalPopUp = true;
            test.stopTest();
      

    }
}

 

 

The error is First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: []

at the marked line please help me to resolve this issue.....

Hi this is my code what i am doing is that i am updating a custum field with activitydate of task. But when my trigger fires the custom field is showing wrong value e.g.

 

ActivityDate ::: 24/7/2012

Custom Field ::: 23/7/2012

This custom field is also datetime field.

 

Here is my code::::::::::::::::::::::::::::::::::::::>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<:::::::::::::::::::::::::::::::::::::::::::::::::

 

trigger UpdateTaskActivityTypeEmail on Task (before insert, before update) {
    String subject;
    for (Task tsk : trigger.new)
      {     
          if(trigger.isInsert || (trigger.isUpdate && tsk.ActivityDate != trigger.oldMap.get(tsk.Id).ActivityDate))
          {
             tsk.Activity_Date__c = tsk.ActivityDate;
          }   
         subject = tsk.Subject;
         if (subject != null && subject.trim() != '' && subject.toLowerCase().contains('email:'))
         {                  
            tsk.aos__Activity_Type__c ='Email (customer or prospect)';
         }
      }
}

 

Any help is highly appreciated...

We have a requirement where we need to show all the custom field on a visualforce page , now what exactly is the issue that I do not know what all are the custom fields in that particular object. This is something like creating a product and giving it to the user, now whenever that user uses the functionality of this product through some button a pop appears where he has the ability to select standard and custom filed of that object. While developing this product we cannot hardcode anything. Therefore I was looking for any help so that I can show all the custom field of that particular object on my visual force page. Any help is highly appreciated.