• Afzal Mohammad
  • NEWBIE
  • 235 Points
  • Member since 2008

  • Chatter
    Feed
  • 9
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 102
    Replies

If todays date could be retreived by

System.today();

How to calculate a date of the previous week

with the same day?

or

If today is tuesday and the date is 19th April

How to calculate the date of last Tuesday?

The answer which we are expecting is 12th of April.

 

Can anyone suggest an efficient formula?

 

Hi everyone,

 

I'd like to hide "Required Information" in pageBlockSection, but I cann' find

an Attribute Name. 

 

Thanks,

Seiji

Hi everyone,

 

I'd like to isolate CalloutException because CalloutException has some events.

For example, unknown protocol, no protocol, Unauthorized endpoint, Read timed out, and etc...

Please let me know if you have best practice.

 

Thanks,

Seiji

 

I want to create a trigger ( after insert) in custom object, which will updated same custom object by selecting value from another custom objects.

 

I have to upload records into this custom object using data loader with more than 30000 records

 

what all the things  I need to take care before developing trigger in respect of governor limits and how can make sure the trigger will no throw error if once data loader process starts.

 

  • April 08, 2011
  • Like
  • 0

Hello,

 

I have an apex class in which i call a web service. I receive a response value from the webservice in which I need to extract a key value from. I've been looking at the XMLStreamReader documentation at http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_xml_XmlStream_reader.htm but I'm still unsure as to what's required.

 

My SOAP response XMl is similar to the following

 

 

<?xml version="1.0" encoding="utf-8"?>
  <soap:Body>
    <user_createResponse xmlns="http://dummyValue">
     <user_createResult>28</user_createResult>
    </user_createResponse>
  </soap:Body>
</soap:Envelope>
I tried to use 
XmlStreamReader xmlRead =  res.getXmlStreamReader();
System.debug('key val = ' + xmlRead.getAttributeValue('', 'user_createResult'));
But I get an error such as "illegal State: Current state is not among the states START_ELEMENT , ATTRIBUTEvalid for getAttributeValue(...."
is it not possible to just name the attribute I want or is it necessary to somehow loop through each element or go to an element number?
Any tips on the above would be welcome.
Thanks!

 

Hi,

 

 

Here is my code.

 

 

trigger dmldata on CnPData__c (before insert,before update) {
 Custom_Question__c[] question = new Custom_Question__c[0];
String dataxml;
  for(CnP__CnPData__c cpdata:Trigger.new){
         dataxml=cpdata.CnP__DataXML__c;
     }
  XmlStreamReader reader= new XmlStreamReader(dataxml);
   
                Custom_Question__c cq = parseQuestion(reader);
                question.add(cq);
                System.debug('questions after parsinggg'+question);
                
                insert question;
Custom_Question__c parseQuestion(XmlStreamReader reader5){
     Custom_Question__c qstn= new Custom_Question__c();
 
    while(reader5.hasNext()) {
     System.debug('event typpeeee in transaction'+reader5.getLocalName());
  if('CustomFieldList' == reader.getLocalName() && reader.getEventType() == XmlTag.END_ELEMENT) {
  
        break;
   }
        else if('FieldName' == reader.getLocalName() && reader.getEventType() == XmlTag.START_ELEMENT){
          reader.next();                   
          if(reader.getEventType() == XmlTag.CHARACTERS) { 
  List<CnP_Transaction__c> cnptransact = [Select Id,Name from CnP_Transaction__c where Name=:ordnum];
            qstn.Name = cnptransact[0].Name;
            qstn.Custom_Question__c= reader.getText();
            System.debug('Question  Nameeeeeeee'+qstn.Name);
   
          }
          }
        else if('FieldValue' == reader.getLocalName() && reader.getEventType() == XmlTag.START_ELEMENT){
          reader.next();                   
          if(reader.getEventType() == XmlTag.CHARACTERS) { 
 
            qstn.Answer__c= reader.getText();
            System.debug('Question  Answer'+qstn.Answer__c);
   
          }
          }
    reader5.next();
    }
    return qstn;
    }

 

}

 

 

And Here is my xml file.

 

 

<?xml version="1.0" encoding="utf-8"?>

<CnPTransactionData>

 

 

<CustomFieldList>

      <CustomField>

 

        <FieldName>Employer</FieldName>

        <FieldValue>Good Company</FieldValue>

      </CustomField>

      <CustomField>

        <FieldName>Occupation</FieldName>

        <FieldValue>Good Job</FieldValue>

      </CustomField>

      <CustomField>

        <FieldName>Place of Employment</FieldName>

        <FieldValue>Blacksburg, Virginia</FieldValue>

      </CustomField>

    </CustomFieldList>

 

</CnPTransactionData>

 

 

 

 

 

My problem is: I can insert a record in custom question easily. but I need to insert 3 records of Custom questions for a single order number(thatis transaction name). How can I loop the code so that 3 custom questions for a single order number has been araised

 

 

Thanks in advance.

I would like to retreive the username in the UserObject.

What is the column name of the username in the UserObject?

Sorry, but I'm new to Apex, and a beginner in programming.

I appreciate if anyone could teach me.

 

What I want to do is retrieve the username in UserObject  referenced from other object.

 

Reagards

 

Mori

 

I have a webservice which calls Batch apex for inserting chunk of records.

The issue is I want to get a success or failure message after running the Batch.

 

Is it possible to return a 'String' through Batch apex?

 

Any help much appreciated.

I'm now testing by running 'Runtests' of  the test class I created.

However, I'm now facing an error explained as follows.

I would like to know  the reason of the error.

I appreciate if  somebody could  help me with the issue

 

(******** is an indication of abbreviation)

 

I wrote in the test class as follows;

 

@isTest
private class (test class name) {

  static testMethod void myUnitTest() {

**************************************

**************************************

(class name) controller = new (classname) ();

 

controller.setIntervalFlg();

 }

}

 

 

the 'class name' above is referenced to the

class to be tested below.

It seems like the error message indicates something wrong with the code written in the line of  ' if(interval.equals('none')) ' below

 

 

public with sharing class (classname) {

****************

****************

****************

public String interval { get; set; }
 public Boolean interval15Flg { get; set; }
 public Boolean interval30Flg { get; set; }
 public Boolean interval60Flg { get; set; }
 public Boolean interval300Flg { get; set; }
 public Boolean interval600Flg { get; set; }
 
 public String nowDatetime { get; set; }
 
 Integer count = 0;
    public PageReference intervalCounter() {
        count++;
        setIntervalFlg();
        refresh();
        nowDatetime = Datetime.now().format('yyyy/MM/dd HH:mm:ss');
        return null;
    }
    public Integer getCount() {
        return count;
    }

 

public void setIntervalFlg(){
  if(interval.equals('none')) {
   interval15Flg = false;
   interval30Flg = false;
   interval60Flg = false;
   interval300Flg = false;
   interval600Flg = false;
  }
  else if (interval.equals('15')) {
   interval15Flg = true;
   interval30Flg = false;
   interval60Flg = false;
   interval300Flg = false;
   interval600Flg = false;
  }
  else if (interval.equals('30')) {
   interval15Flg = false;
   interval30Flg = true;
   interval60Flg = false;
   interval300Flg = false;
   interval600Flg = false;
  }
  else if (interval.equals('60')) {
   interval15Flg = false;
   interval30Flg = false;
   interval60Flg = true;
   interval300Flg = false;
   interval600Flg = false;
  }
  else if (interval.equals('300')) {
   interval15Flg = false;
   interval30Flg = false;
   interval60Flg = false;
   interval300Flg = true;
   interval600Flg = false;
  }
  else if (interval.equals('600')) {
   interval15Flg = false;
   interval30Flg = false;
   interval60Flg = false;
   interval300Flg = false;
   interval600Flg = true;
  }

}

Needed VisualForce/Apex developer.

 

This is a contract position and location is Islandia.

 

send your resumes to yoafzal@yahoo.com.

Job description

 

We are a product development MNC and have requirement for following job description.

  1. Should have working knowledge of Visual force pages/components/s-controls and triggers.
  2. Sound knowledge of Apex API, Classes, Validation Rules, Formula field and outbound messages.
  3. Knowledge of Flex, Ajax, Workflows, Web Services and External web service callouts is preferrable.

As a company policy am not using my office mail id here. So, send your resume ASAP to yoafzal@yahoo.com.

 

Location is not a constraint, but India is preferrable.

 

regards,

Mohammad Afzal.

In a test class, I am trying to create an opportunity of a specified record type. 

 

   //create opportunity record
        String opportunityName= 'xxxx';
            Opportunity o = new Opportunity(
            AccountId=a.Id, 
            Name=opportunityName, 
            StageName='Prospecting', 
            CloseDate=Date.today(),
            Opportunity_Type__c='New',
            LeadSource='xxx',
            RecordTypeId= [Select Id From RecordType Where Name = 'xxx' and SobjectType= 'Opportunity'].Id);
            
        insert o;
        system.debug(o.RecordType.Name);
        

 

However this returns- null in the debug statement. I'm sure i'm overlooking something simple. Any help?

  • December 03, 2013
  • Like
  • 0

hi friends

i got this requirement.

please help

In Account object i created one custom field called " COUNT" so the question is ,whenever i created a contact related to that account ,COUNT custom field has to show the number,how many contacts has been created so far....

one important thing is ,pls consider all events in trigger...like before insert,after update and delete also come into the existence...

how do i write trigger for this..

Thanks

I wanted to check where some of the fields from a custom object are being referenced in either a Visualforce page or an apex class.Is there a way to check this?

Hi all,

 

        i created site using sieforce(site.com), how to publish this site, what will i do for publish site?

 

 

Thank you.

Hai,

 

I am getting Error Please Resolve it...

 

Error: System.DmlException: Update failed. First exception on row 0 with id 00QK0000003I8KhMAK; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, LeadAfterUpdate: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, o2bc.SetOrderLineItemPrice: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object (o2bc): [] Trigger.LeadAfterUpdate: line 64, column 1: [] (System Code) 

 

My Trigger is below:

 

trigger LeadAfterUpdate on Lead (after update)
{
    System.debug('******AfterUpdate********' );
    Set<Id> leadIdsSet = new Set<Id>();
    List<Customer_Certification_Line__c> Progrms = new List<Customer_Certification_Line__c>();
    for(Integer i=0;i<Trigger.old.size();i++)
        leadIdsSet.add(Trigger.old[i].id);
    System.debug('******leadIdsSet*******'+leadIdsSet);    
    System.debug('******Trigger.old[0].IsConverted*******'+Trigger.old[0].IsConverted);
    List<Lead> leadList = [Select id,Credit_Card_Number_Enc__c,mailing_city__c,mailing_address_1__c,mailing_address_2__c,mailing_state__c,mailing_zip_code__c,(SELECT Account__c,Certification_Name__c FROM Customer_Certification_Lines__r),ConvertedAccountId,(Select id,Item__c,Lead__c,Quantity__c from Lead_Line_Items__r) from Lead where IsConverted = true and id in :leadIdsSet];
    System.debug('******leadList*******'+leadList);
    if(leadList.size()>0)
    {
        if (lead.ConvertedAccountId != null) {
            
            for(Lead lead:leadList){
                system.debug(lead.ConvertedAccountId);
                Account a = [Select a.id,a.shippingstreet,a.shippingcountry,a.shippingstate,a.shippingPostalCode,a.shippingcity From Account a Where a.Id = :lead.ConvertedAccountId];
                System.debug('******account fields*******'+a);
                a.shippingcity = lead.mailing_city__c;
                if(lead.mailing_address_2__c!=null)
                    a.ShippingStreet = lead.mailing_address_1__c+' '+lead.mailing_address_2__c;
                else
                    a.ShippingStreet = lead.mailing_address_1__c;
                    a.shippingstate = lead.mailing_state__c;
                    a.ShippingPostalCode = lead.Mailing_Zip_Code__c;
                    a.o2bc__Credit_Card_Number__c = lead.Credit_Card_Number_Enc__c;
                update a;
            }
 
        }
        Map<Id,o2bc__Sales_Order__c> accountIdSalesOrderMap = new Map<Id,o2bc__Sales_Order__c>();
        for(Lead lead:leadList)
        {
            o2bc__Sales_Order__c salesOrder = new o2bc__Sales_Order__c();
            salesOrder.o2bc__Account__c = lead.ConvertedAccountId;
            accountIdSalesOrderMap.put(lead.ConvertedAccountId,salesOrder);
        }
        system.debug('Size is--------->' + accountIdSalesOrderMap.size());
        insert accountIdSalesOrderMap.values();
        System.debug('******accountIdSalesOrderMap*******'+accountIdSalesOrderMap);
        List<o2bc__Order_Line__c> orderLineList = new List<o2bc__Order_Line__c>();
        for(Lead lead:leadList)
        {
            for(Lead_Line_Item__c leadProductLineItem:lead.Lead_Line_Items__r)
            {
                o2bc__Order_Line__c orderLine = new o2bc__Order_Line__c();
                orderLine.o2bc__Item__c = leadProductLineItem.Item__c;
                orderLine.o2bc__Sales_Order__c = accountIdSalesOrderMap.get(lead.ConvertedAccountId).id;
                orderLine.o2bc__Quantity__c = leadProductLineItem.Quantity__c;
                orderLineList.add(orderLine);
            }
            if(lead.Customer_Certification_Lines__r.size()>0){
                
                for(Customer_Certification_Line__c oProgram : lead.Customer_Certification_Lines__r){
                    
                    Customer_Certification_Line__c oProgramList = new Customer_Certification_Line__c(id = oProgram.Id);
                    oProgramList.Account__c = lead.ConvertedAccountId;
                    Progrms.add(oProgramList);
                }
            }
        }
        System.debug('******orderLineList*******'+orderLineList);
        insert orderLineList; // ----->Line 64
        if(!Progrms.isEmpty()){
            update Progrms;
        }
    }
}

Hai All,

 

When i am converting a lead Its giving Error

Error: ConvertLead Failed: First exception on row 0; First error: UNAVAILABLE_RECORDTYPE_EXCEPTION,unable to find defaultnrecord type[]

 

Below is the Class code On convert lead

// This class is meant to hold all the code which will be reusable and common processes. Some webservice methods we can write here also.

global class Lead_Manager
{
    // Responsible for lead conversion from standard page layout.
    // Below webservice method is being called on the click event of the custom convert button on the standard lead page layout.
    WebService static String convertLeadByConvertCustomeButton(String leadId)
    {
        try
        {
            Lead led = [Select id,Name,Status,LeadSource ,IsConverted ,(Select id,ContentType,Name,LastModifiedDate from Attachments) from Lead where id = :leadId];
            if(led.Attachments.size()==0)
                return 'Please upload documents before converting the lead.';
            if(led.Status=='Approved')
            {

             // Here it is throwing Error
                Database.LeadConvert lc = new database.LeadConvert();
                lc.setLeadId(leadId);
                LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                lc.setConvertedStatus(convertStatus.MasterLabel);
                lc.setDoNotCreateOpportunity(true);
                Database.LeadConvertResult lcr = Database.convertLead(lc);
                //ApexPages.addMessage(new ApexPages.message(ApexPages.severity.confirm,'Lead has been converted successfully.'));
                led = [Select id,Name,Status,LeadSource ,IsConverted ,ConvertedAccountId,ConvertedContactId from Lead where id = :leadId];
                /* List<Contact> contactList = [Select id from Contact where id=:led.ConvertedContactId];  
                if(contactList.size()>0)
                    delete contactList; */
                return String.ValueOf(led.ConvertedAccountId);
            }
            else
                return 'CSR has not approved the lead so it can not be converted.';
            
        }
        catch(System.Exception e)
        {
            return e.getMessage();
        }
    }
 
    //Lead conversion custom method. This method will take an instance of Lead object
    //and will convert it without creating opportunities and returned the converted lead to its caller.
    // Responsible for lead conversion from visual force.
    public static Lead convertLead(Lead lead)
    {
        Database.LeadConvert lc = new database.LeadConvert();
        lc.setLeadId(lead.Id);
        LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
        lc.setConvertedStatus(convertStatus.MasterLabel);
        lc.setDoNotCreateOpportunity(true);
        
        Database.LeadConvertResult lcr = Database.convertLead(lc);
        Lead led = [Select id,Status,LeadSource ,ConvertedAccountId,RecordType.Name,Name,OwnerId,CreatedById,FirstName,LastName,Street,City,State,PostalCode,Email,phone,Last_4_digits_SSN__c,Date_of_Birth__c,IsConverted,
                            Enrollment_Id__c,EBT_Number__c,EBT_Holder__c,Number_of_Persons_or_Household__c,Monthly_Income__c,Yearly_Income__c
                            from Lead
                            where id = :lead.id];
       return led;
    }
 
 
    @RemoteAction
    global static String checkLeadApprovalStatusByCSR(String leadId)
    {
        Lead lead = [Select id,Status from Lead where id = :leadId];
        if(lead.Status == 'Approved')
            return '1';
        else
            return '0';
    }
 
}

I am writing a test class for a trigger that tries to identify account duplicates in the system based on Account Name, Street & Phone matching or Name & Phone matching or Name & Street matching. The test class that I have written is giving me 100% coverage, but I am getting 1 test failure:

 

Message: System.AssertException: Assertion Failed: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, <BR/>Agency record with this Name/Phone/Physical Street exists in the system. If you wish to create agency record, change field value of "Create New Record" to YES.<BR/><BR/> Potential Duplicate Agencies Include:<BR/>Agencies with Name, Phone & Physical Street match: <a href=https://cs14.salesforce.com/001c0000004PPquAAG>Agency000</a> | <BR/>Agencies with Name & Phone match: <a href=https://cs14.salesforce.com/001c0000004PPquAAG>Agency000</a> | <BR/>Agencies with Phone & Physical Street match: <a href=https://cs14.salesforce.com/001c0000004PPquAAG>Agency000</a> | <BR/>Agencies with Name & Physical Street match: <a href=https://cs14.salesforce.com/001c0000004PPquAAG>Agency000</a> |

 

Stack Trace: Class.Test_trg_AccountDuplicatePreventer_Final.Test0_TestInsertWithValue: line 18, column 1

 

Test Class is:

 

@isTest(seeAllData = true)

public class Test_trg_AccountDuplicatePreventer_Final{
static testMethod void Test0_TestInsertWithValue()
{

//Set<Account> Accset = new Set<Account>();

Account acc1 = new Account(Is_record_near_to_duplicate__c='No', Name = 'Agency0', Phone='(981) 130-9977',Physical_Street__c = 'ABC0', Physical_State_Province__c = 'NY',Physical_City__c = 'NY',Physical_Zip_Postal_Code__c = '2010',Physical_Country__c= 'USA');
Account acc2 = new Account(Is_record_near_to_duplicate__c='No', Name = 'Agency00', Phone='(981) 130-9988',Physical_Street__c = 'ABC00', Physical_State_Province__c = 'NY',Physical_City__c = 'NY',Physical_Zip_Postal_Code__c = '2010',Physical_Country__c= 'USA');
Account acc3 = new Account(Is_record_near_to_duplicate__c='No', Name = 'Agency000', Phone='(981) 130-9999',Physical_Street__c = 'ABC000', Physical_State_Province__c = 'NY',Physical_City__c = 'NY',Physical_Zip_Postal_Code__c = '2010',Physical_Country__c= 'USA');

Account[] accs = new Account[]{acc1,acc2,acc3};
try{
insert accs;
}catch(DMLException ex)
{
System.assert(ex.getMessage().contains('Insert failed. First exception on'+ 'row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION,'+'<BR/>Agency record with this Name/Phone/Physical Street exists in the system. If you wish to create agency record, change field value of "Create New Record" to YES.<BR/><BR/> Potential Duplicate Agencies Include:<BR/>Agencies with Name, Phone & Physical Street match:<a href=https://cs14.salesforce.com/accs.id>accs.Name</a>'),
ex.getMessage());
}


acc2.Phone='(981) 130-7777';
acc3.Physical_Street__c='ABC0000';
acc3.Phone='(981) 130-8888';
update accs;

Account dupe1 = new Account(Name = 'Agency0', Phone='(981) 130-9977',Physical_Street__c = 'ABC0',
Physical_State_Province__c = 'NY',Physical_City__c = 'NY',Physical_Zip_Postal_Code__c = '2010',Physical_Country__c= 'USA');

try{
insert dupe1;
System.assert(false);
}catch(DMLException e){
for (Integer i = 0; i < e.getNumDml(); i++)
{
System.assert(e.getNumDml() == 1);
System.assert(e.getDmlIndex(i) == 0);
System.assert(e.getDmlFields(i).size() == 3);
System.assert(e.getDmlFields(i)[0] == Account.Name);
System.assert(e.getDmlFields(i)[1] == Account.Phone);
System.assert(e.getDmlFields(i)[2] == Account.Physical_Street__c);
System.assert(e.getDmlMessage(i).indexOf('An account with this name, phone, street already exists.') > -1);
}
}

Account dupe2 = new Account(Name = 'Agency00', Phone='(981) 130-9988',Physical_Street__c = 'ZZZ',
Physical_State_Province__c = 'NY',Physical_City__c = 'NY',Physical_Zip_Postal_Code__c = '2010',Physical_Country__c= 'USA');

try{
insert dupe2;
System.assert(false);
}catch(DMLException e){
for (Integer i = 0; i < e.getNumDml(); i++)
{
System.assert(e.getNumDml() == 1);
System.assert(e.getDmlIndex(i) == 0);
System.assert(e.getDmlFields(i).size() == 3);
System.assert(e.getDmlFields(i)[0] == Account.Name);
System.assert(e.getDmlFields(i)[1] == Account.Phone);
System.assert(e.getDmlFields(i)[2] == Account.Physical_Street__c);
System.assert(e.getDmlMessage(i).indexOf('An account with this name, phone already exists.') > -1);
}
}

dupe1 = new Account(Id=acc1.id, Name = 'Agency0', Phone='(981) 130-0000',Physical_Street__c = 'ABC0',
Physical_State_Province__c = 'NY',Physical_City__c = 'NY',Physical_Zip_Postal_Code__c = '2010',Physical_Country__c= 'USA');

update dupe1;
System.assert(false);
}
}

 

 

Can someone pls tell me why this test failure?

 

I am currently unable to use the Site.com stylesheet editor because the stylesheet that our website uses contains some unusual CSS rules (ie. browser-specific properties and CSS3 declarations). When I paste my CSS into Site.com's editor and then click save, it either attempts to automatically correct what it thinks are errors, or it doesn't even let me save.

 

I think we need the ability to choose whether or not Site.com automatically corrects any "errors" in our stylesheets.

Hello,

 

I am trying to build sites using sites.com and cannot seems to find a way to allow users to upload content using sites created using sites.com.

 

Also, when i added a repeater for Content its not displaying any data.

 

Can anyone help me with this.

 

Thanks,

Hi,

 

I made some code changes in UAT environment accprding to the requirement.

 

I need the same changes should be reflect in Production environment.

 

So how i can do that?

 

Please provide me some information on the process to sync two environment (UAT and Prod)also.

 

Regards,

Pragnya

I am using the following html page as the login page for my REST app. But I am getting consistently the redirect_url mismatch error. I have checked the url and I am sure that the url string is correct. I have also tried other urls but the error keeps popping up. What am I doing wrong?

 

<html>
    <body> <%-- onLoad="document.authorizationForm.submit()">  --%>
    <form action="https://login.salesforce.com/services/oauth/authorize" method="post" name="authorizationForm">    
      <input type="hidden" name="response_type" value="code"/>    
      <input type="hidden" name="client_id" value="3MVG9rFJvQRVOvk6sl7xMXtrbyQb2XUv2vprLKWv0uxBLKFzNqtHJG6cmzuemPYDB3hPwqXsBlw0BGQPkb81P"/>
      <input type="hidden" name="redirect_url" value="https://10.132.35.240:8443/"/>
    </form>
  </body>
</html>

 

 

 

error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration

Hello Friends,


I want to know about Base Class of all standard controller class that can help me to put my single Embedded VF Page in any Object of that Org.

 

I am working on a project which required single VisualForce Page and single Controller, that can be Embedded in any Object  of that Org.

 

I am able to create single controller but unable to create single VF Embedded Page for all Object in an Org

 

For VF Embedded Page <apex:page block required standardController attribute to make Page to be visible in Edit Layout of that object

 

Your Assistance will make me to work fwd.

 

Thanks,

Tushar 

Hello Community,

 

I created a vf email template that will be sent when a portal user hits a submit button in the Portal. I'm encountering the following error:

 

SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, Read access denied for Timesheet_Period__c.

 

I'm wondering why this error occurs whereas other functionality in the portal connected to the object Timesheet_Period__c is working fine. I tried accessing the vf page inside salesforce and it works fine, the problem is in portal.

 

Below is the email template: 

 

<messaging:emailTemplate subject="Timesheet Approval" recipientType="User" relatedToType="Timesheet_Period__c">
<messaging:htmlEmailBody >
<c:EmailApprover period="{!relatedTo.Id}"/>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

 

My guess is that the {!relatedTo.Id} triggers the problem. I'm not sure what's the step should I make in addressing this problem.

 

Any help will be appreciated.

Hi Guys,

 

We have two classes System and Datetime in apex. Both provides static now  method. I want to know what is difference between now method from System and Datetime class. I would also like to know broad idea of System class and when to use it?

 

 

 

Thanks

Hi

 

   I implemnted pagination accordingt to below url

    http://forceguru.blogspot.com/2011/04/pagination-in-salesforce.html

 

   http://blog.jeffdouglas.com/2009/07/14/visualforce-page-with-pagination/

 

One thing I noticed is the checkboxes don’t maintain state if you check one, go to the next page, then go back. I think it’s due to line 20 in your controller, as it recreates the List of wrapper objects with each page.

 

  Can One has solu to fix this issue...

 

Thanks

ashok

Hi,

 

        I want to display the total account records and detail page of those records in visual force page. But i want to display the the records and detail page in visual force page only using visual force page code and  with out using the controller. Any one please help me how to reach the requirement.

 

Thanks,

Lakshmi.

Hi,

 

In our instance we have a couple of classes generated by wsdl2apex that "randomly" (I cannot see a pattern) throws a System.CalloutException with the message "Failed to get next element". I have googled a bit but couldn't find anything that I could think was related. The web services called logs all attempts but when I get this exception I can't see that the web services has been accessed at all. The web services are all build with .NET 3. 

 

I don't know what the best way to start troubleshoot this is. So I thought I should give the boards a try!

 

Any suggestions or ideas are welcome!

 

Thanks!

 

Martin

 

 

  • April 07, 2011
  • Like
  • 0

I am invoking an approval process in an after update trigger which results in bunch of runtime errors. The approval process works flawlessly when submitted through default "Submit for Approval" button

 

below is my trigger code and the run time error messages 

 

trigger Approval_Process on SPA__c (after update){

for(SPA__c sp: Trigger.new){

if (sp.Submit_for_Approval__c){

Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();

req1.setComments('Submitting request for approval.');

req1.setObjectId(sp.id);

req1.setNextApproverIds(new Id[] {UserInfo.getUserId()});

//req1.setNextApproverIds='005Q0000000IFNf';

Approval.ProcessResult result = Approval.process(req1);

System.assert(result.isSuccess());

System.assertEquals('Pending', result.getInstanceStatus(), 'Instance Status'+result.getInstanceStatus());

}

}

}

 The runtime errors I get are

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

NO_APPLICABLE_PROCESS

 

The detailed message is below

 

Error: Invalid Data. Review all error messages below to correct your data.Apex trigger Approval_Process caused an unexpected exception, contact your administrator:

Approval_Process: execution of AfterUpdate caused by: System.DmlException: Process failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY,

Approval_Process: execution of AfterUpdate caused by: System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process found.: [] Trigger.Approval_Process: line 11, column 45: []: Trigger.Approval_Process: line 11, column 45

 

 

 

 

 

  • January 21, 2010
  • Like
  • 0

I am getting a strange error message as above.

 

I have an interface {say A} which has one method. I have a class {say B} that implements the interface (the method). And I have another class/method that takes interface A as a parameter. And I call that method with an instance of the class B. All compiles ok. But I got the error when running it.

 

I do not see what can possibly be wrong with my code. If I do not implement the method in A, it fails to compile. If I remove 'implements A' from B, it fails to compile. Also I have another class {C} that implements the interface A, and is used in exact same way and it works fine.

 

Anyone has seen similar issues?