• Sivarajan
  • NEWBIE
  • 130 Points
  • Member since 2009


  • Chatter
    Feed
  • 5
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 34
    Replies
A simple format call on a datetime is return the wrong value.  A year that should be 2015 is coming back 2016.  Am I missing something?

Here is a simple 3 line code example that demonstrates the problem:
 
// Create a DateTime of December 27, 2015
datetime dtTemp = DateTime.newInstance(2015, 12, 27, 0,0,0);
// Format that Date Time - Should Be; December 27, 2015
String sFormatedDate = dtTemp.format('MMMM d, YYYY');
system.debug('++++++++++++++++++Formatted Date  = ' + sFormatedDate);
// Actual is coming back December 27,2016

 

I couldn't capture and display the options selected in the visualforce page. I include my controller and visualforce page. Intent is a custom object. Everything looks fine, don't know what i am missing.

 

 

public class intent{

String[] intent;

public String[] getintent(){
       return intent;
}

public void setintent(String[] intent){
        this.intent = intent;
}

public list<SelectOption> getintents(){

    list<Intent__c> custintents = new list<Intent__c>();
    custintents = [SELECT Name FROM Intent__c order by CreatedDate ASC];
    
    List<SelectOption> options = new List<SelectOption>();
    
    for(Intent__c custintent : custintents){
        options.add(new SelectOption(custintent.Name,custintent.Name));
    } 
    return options;
}

public PageReference Next(){ 
    return null;

}

}

 

<apex:page controller="intent">
<apex:form id="form1">
    <apex:selectCheckboxes value="{!intent}" onselect="{!intent}">
        <apex:selectOptions value="{!intents}"> </apex:selectOptions>
    </apex:selectCheckboxes>
    <apex:commandButton action="{!Next}" value="Next" reRender="out" status="status"/>
</apex:form> 

<apex:outputPanel id="out">
        <apex:actionstatus id="status" startText="testing...">
            <apex:facet name="stop">
                <apex:outputPanel >
                    <p>You have selected:</p>
                    <apex:dataList value="{!intent}" var="c">a:{!c}</apex:dataList>
                </apex:outputPanel>
            </apex:facet>
        </apex:actionstatus>
    </apex:outputPanel>
       
</apex:page>

 

 

 

  • July 29, 2010
  • Like
  • 0

    I am new to salesforce development. I read that in the B2C scenario one can use  Person Account Record Type. But i could not found the record type  App-> Cutomize->Account -> Person Record Type.  Am i missing any configuration setting ? I am using Developer Edition of SalesForce.

 

Thanks

 

 

Hi,

 

I had made a field mandatory in one of my custom objects. Now, I have removed the 'always require a value' condition. I dont have a problem whenever I create a new record. The problem comes only when I try to edit the record. It still is a mandatory field in the edit page. Kindly help me out.

 

Thanks.

  • January 04, 2010
  • Like
  • 0

I've created a controller for a custom object to retrieved every contact related to the account that is related to my custom object.

 

                 Account

              ^            |

             /              |

            /               v

Custom_Object     Contact

 

But, I can't fix my the account Id to search for in the SOQL. I get a Illegal assignement for my code below but, I don't seem to find the good way to do it. Does someone has a good hint to help me start?

 

 

public class addon {
  private final Meeting_Preparation__c Meeting_PreparationObj;
  public addon(ApexPages.StandardController controller) {
    this.Meeting_PreparationObj = (Meeting_Preparation__c)controller.getSubject();
  }

  public Meeting_Preparation__c[] getRelatedContact() {
       ID Custom_Account_ID = Meeting_Preparation__c.Account__r.id;
    Contact[] contactList =
      [ SELECT Name, Title, MobilePhone, Relationship__c, Owner.Name, CreatedBy.Name

        FROM Contact

        WHERE Account.Id = :Custom_Account_ID];
 

   return contactList;
 }
}

Hi Folks,

i use lightning-edit-form in my lighting web component. Would like to validate some backend logic based on the customer inputs entered in the edit form using apex class method.  How to validate the logic and show lightning error message before clicking save button.

i tried to show the sample error  message for testing on the event of submit or onclick of the lightning-record-edit-form.

how to check the logic and through the error before save the record.

Thanks
siva
We use Third party call center tool . I use OpenCTI to update the calldata once a call is completed . I included all the library files but the following SaveLog not at all getting called hence Account record is not created.

    var callback = function (response) {
            if (response.result) {
                      alert(response.result);
               } else { 
                      alert(response.error);
               }
           }
     sforce.interaction.saveLog('Account','Name=NewAccountName&Phone=4155551212',callback);

I included the following script in the top of the visualforce.
     <apex:includescript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />
    <apex:includescript value="/support/console/33.0/integration.js" />
    <apex:includeScript value="{!URLFOR($Resource.cnx__CnxSfdcResources,'js/ConnectsIntegrationAPI.min.js')}"/>
    <apex:includescript value="/soap/ajax/33.0/connection.js" />
    <apex:includescript value="/support/api/33.0/interaction.js" />
  
In the Console, It does not return any message.
Any help much appreciated.
 
Hi Folks,

If a string contains atleast one chinese character then i have return a boolean. I am looking for exact regular expression to use in pattern.matches method.

Any help much appreciated.
 
I have a quick Action button which is overridden with vf page on Case feed. Once I fill all the information and click Submit, it gets redirected to standard case feed record page instead of staying on Service console.

I call the following javascript method in action function:
oncomplete="Sfdc.canvas.publisher.publish({name : 'publisher.refresh', payload : {refresh: true }});"

I also tried the following but it does not work.
oncomplete="Sfdc.canvas.publisher.publish({name : 'publisher.refresh', payload :{refresh: "true" objectRelatedLists: {}}});"

I want to stay on Service console Once i complete the action. Any help much appreciated.
Hi Everyone,

I run my test class in salesforce user interface and I opened my developer console to see the code coverage of related Apex class. In the overall code coverage section, i am able to see my Apex class and it shows percentage and lines covered (78, 114/130)

When i clicked the class in code coveage section, it is not showing the information like what are the lines of covered (in Blue color), what are all lines are not covered (in Red). Instead of the it shows as Code coverage : none in the drop down.

Much appreciated if anyone share your thoughts or if you come across similar issue.

Hello Everyone,

 

when I change the price book, All the opportunity with the following evaluation criteria getting fired unnecessarily.

Evaluation Criteria : When a record is created, or when a record is edited and did not previously meet the rule criteria

I went through some of the Salesforce community scraps and got to know that it's kind of bug or standard behavior.

I have used ISChanged function in the rule criteria for the workflow rules with the Evaluation Criteria ( When a record is created or edited ). it works fine.

I want to apply the same changes(ISChanged function on a particular field) to the workflow with the criteria (When a record is created, or when a record is edited and did not previously meet the rule criteria). Generally you can't use this function here and I can't change evaluation criteria to "When a record is created or edited " because it has time dependent workflow action(It is must).


Please suggest some good solution to resolve this issue...

your help would be very much appreciated.

 

 

Hi All,

 

In my scenario, Leads which are created in Salesforce are came from 3rd party application. Chinese character(Double byte character) are properly displaying in all lead fields except the following fields

1) Description (Standard field - Data type (Long Type Area))

2)Lead Notes (Custom field- Data type (Long Type Area))

 

Instead of displaying the Chinese characters, it shows the two characters "??" for a chinese character.

 

It's not displaying the chinese characters. Any great idea would be appreciated.

 

Thanks in advance.

 

Hi Everyone,

 

 

I would like to check logged user role with a role of particular record owner. If logged user role is on top of the record owner user role then I would like to show a visualforce page. any idea How to do that it very simply ?

 

Thanks in advance !

 

Hello All,

 

I have two account lookup fields in Opportunity. One is Standard lookup field and another is custom lookup field.  If i create an Opportunity from Contact page, I just want to prepoluate custom Account lookup field instead of standard account field on Opportunity.

 

I created a custom button with following URL and replaced New button of Opportunity. it's working fine as i expected.

I have a trigger(after insert,update) on Opportunity that will update the standard Acount lookup field.

 

/006/e?CF00N30000004oFdw={!Account.Name}

 

Once I create an Opportunity from contact , it should create Contact Role record and it wil be shown in Opportunity Contact role related list.

 

In my case, it 's not creating contact role record. I am missing something. can anyone please assist me on this.

 

Thanks in advance.

 

 

 

Hi,

 

In the Contact page, I have replaced the New button on Opportunity related list with Cusotm button (Source is URL).

When I create an Opportunity from Contact, The Acount field of Contact is prepopulated . I have one more Account lookup field in Opportunity. I just want to clear the standard Account lookup field of opportunity and want to prepopulate the custom account lookup field.

 

I fetched HTML id and populated the Account Name in custom lookup field in Opportunity but how to clear the standard Account lookup field in Opportunity (I don't want to mention any values in standard account lookup field?

 

Please help me to get a solution .

 

Thanks in advance...

 

 

 

Hi All,

 

I have added a list of attendees(Contact) to an Event and sent the invitation to them but that event is not showing as a related list of Open Activities in Contact even after accepting the invitation by attendees. How do we track this meeting with each of these client contacts?

 

 

 

Hello All, How can we retrieve the delegated administration information in Salesforce. Actually in my case, the Delegated admins should not be allowed to set a particular value. I like to do it in validation rule. If it is not possible in validation rule, then I'm okay with trigger. Can anybody have any ideas? Thanks for your assistance in advance. Regards Siva

Hi Everyone,


I overridden the Contact View button with a visualforce page(using Standard controller and Extension. Not using the Apex:Detail component) due to masking needed on some fields.

The custom contact detail page shows properly with related lists. I just want to include Hover Links for all the related lists of contact over the top of visual page as we have in standard page. I didn't get any proper solution in salesforce community also. Can anyone give the solution for this ?

Thanks in Advance... :-)

Hi,

 

I just want to create a record in an object when i click button on the detail page.I have made the logic in an Apex class and calling the method by using javascript. Please see the following code

 

try
{
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
  
    var opportunityName ="{!Opportunity.Id}";
   alert("Hi");
   alert(opportunityName);
   sforce.apex.execute("QuoteToOrderConverterController","QuoteToOrderConverter", {a:opportunityName});
}
 catch(e)
{
alert("Error while converting from Quote to Order");
}

 

 

 

 

Here it 's showing Error as  {faultcode: 'soapenv:client', faultString: ' No Operation available for request {http://soap.sforce.com/schemas/package/QuoteToOrderConverterController}QuoteToOrderConverter,please checkthe WSDL for the Service.' ,}

 

Please assist.

 

Thanks in advance.

 

Hi,

 

I have a test method for a Apex class.I'm getting more than 75 % coverage on test method. If i deploy the test method from sandbox to Production org then i'm getting the following Error.

 

'Apex Heap Size is too Large'.

 

Please suggest any solution for this.

 

Thanks in advance.

 

 

Hi,

 

I just want to create a standard territory record in a testmethod but it's not allowing to do any DML operation on Territory. Could anyone tell me a solution. Because of based on that only i can cover most code on testmethod.

 

Thank you for ur reply...

Message Edited by Siva_org on 10-28-2009 07:05 AM

Hi,

 

I am having a custom button which calls visual force page(having controller calling batch apex class) which should 1st give me a message let say 'kTerritories are currently being assigned. Please wait'. But then I want the control on same page with the message showing dynamic value of how many batch job processes are done (values fetching from AsyncApexJob object). Like say, 10 processes completed, 20 processes completed , etc as per status in Apex Jobs queue.

 

I am not getting that value. Please assist me on how can I get that value to be shown to the user who clicks that button.

 

Also, just want to know if this can be really possible to show the dynamic processing of batches at runtime because from Apex document it says that:-

 

=============== 

ID batchprocessid = Database.executeBatch(reassign);
AsyncApexJob aaj = [SELECT Id, Status, JobItemsProcessed, TotalJobItems, NumberOfErrors
FROM AsyncApexJob WHERE ID =: batchprocessid ];

===============

 

which, as per my knowledge means that the values of all these fields will be obtained once all batches are processed. Correct me if I am wrong.

 

Please see below the vf page and the controller class(having batch apex logic too):-

 

 

VisualForce Page:-

 

<apex:page controller="BatchApexTerritoryAssignmentBulk" tabStyle="Territory__c" action="{!navigate}" >
    <apex:sectionHeader title="Assigning Territories" />
     
    <apex:pageBlock >
   
       <apex:image url="{!$Resource.BusyImage}" /> &nbsp;&nbsp;
       Territories are being assigned to Leads, Accounts and Opportunities.
       Please wait for the process to get complete .....
       <apex:form >
       <apex:outputText value="Number of batch jobs processed : {!no_jobs_processed}" id="process_counter"/>
       <apex:actionPoller action="{!jobProcessing}"  rerender="process_counter" interval="30"/>
      
      
       </apex:form>

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

 

 

Controller Class:-

 

global class BatchApexTerritoryAssignmentBulk implements Database.Batchable<SObject>
{
  public String query;
  public Static Id batchId;
  public Integer no_jobs_processed{get;set;}
 
  public String lead1 = 'Lead';
  public String acc = 'Account';
  public String opp = 'Opportunity';
 
  public void navigate()
  {
  BatchApexTerritoryAssignmentBulk.BatchApexMethod(lead1);
 
  } 
  /*
  public  Integer getno_jobs_processed()
  {
  AsyncApexJob aaj;
 
  if(batchId != null)
  {
  aaj =  [select Id,JobItemsProcessed from AsyncApexJob where Id =: batchId];
  no_jobs_processed = aaj.JobItemsProcessed;
  }
  else
  no_jobs_processed = 25;
 
  return  no_jobs_processed;
  } 
   */
 
  public void jobProcessing()
  {
  AsyncApexJob aaj;
 
  if(batchId != null)
  {
  aaj =  [select Id,JobItemsProcessed from AsyncApexJob where Id =: batchId];
  no_jobs_processed = aaj.JobItemsProcessed;
  }
   
  }
 
 
 

 

 
 /* public void navigate()
 {
    System.debug('Inside navigate');
   
    BatchApexTerritoryAssignmentBulk.BatchApexMethod(lead1);
   
   // no_jobs_processed = BatchApexTerritoryAssignmentBulk.batchJobStatus_Processes();
   
  //  BatchApexTerritoryAssignmentBulk.BatchApexMethod(acc);
  //  BatchApexTerritoryAssignmentBulk.BatchApexMethod(opp);
   
    //PageReference pageRef = new PageReference('/a0G?fcf=00BT0000002dwWH');
    //pageRef.setRedirect(true);  
    //return pageRef;
 }  
 */
 

 
 

 global database.Querylocator start(Database.batchableContext bc)
 {
   //Integer cont;
  
   try
   {
   /*if(query == null)
   cont = 1;
   else
   cont = 0;
   if(cont == 0) */
   return Database.getQueryLocator(query);
  /* else
   return null;*/
   }
   catch(Exception e)
   {
   System.debug('Exception'+e);
   }
   return null;
 }

 global void execute(Database.BatchableContext BC, List<SObject> sobjList)
 {
  //batchId= BC.getJobId();
  System.debug('Batch Id'+batchId);
 // System.debug('Job Items processed'+BC.getJobItemsProcessed());
  //System.debug('Total Job Items '+BC.getTotalJobItems());
 

 
  System.Debug('DATABASE.BATACHABLE CONTEXT' + BC);
  System.Debug('SOBJECT LIST SIZE PASSED AS QUERY : ' + sobjList.size());
  TerritoryAssignmentBulk tabObj = new TerritoryAssignmentBulk();
  List<Lead> leadList = new List<Lead>();
  Map<Id,Account> accMap = new Map<Id,Account>();
  List<Opportunity> oppList = new List<Opportunity>();
  
  try
  {
  for(sobject s : sobjList)
  {
   if(s.getsObjectType() == Lead.sObjectType)
   {
    Lead l = (Lead)s;
    if(!l.isConverted)
    {
     leadList.add(l);
    }
   }
  }
  System.Debug('LEAD LIST SIZE : ' + leadList.size());
 
  if(leadList.size()!=0)
  {
   tabObj.runRules(null, null, leadList, false);//The method that needs to be called, for lead all others will be null and boolean false
   update leadList;
     
  }

 
 
  //batchJobStatus_Processes();
  //System.debug('No.of jobs processed'+no_jobs_processed);

 

  /*for(sobject s : sobjList)
  {
   if(s.getsObjectType() == Account.sObjectType)
   {
    Account a = (Account)s;
    accMap.put(a.id,a);
   }
  }
  if(accMap.size()!=0)
  {
   tabObj.runRules(oppList, accMap, leadList, false);//The method that needs to be called, for lead all others will be null and boolean false
   update accMap.values();
  } */
  }
  catch(Exception e)
   {
   System.debug('Exception'+e);
   }
 
 }


 global void finish(Database.BatchableContext BC)
 {
  AsyncApexJob a = [Select Id, Status, NumberOfErrors, JobItemsProcessed,TotalJobItems, CreatedBy.Email
  from AsyncApexJob where Id =:BC.getJobId()];
 
  // Send an email to the Apex job's submitter notifying of job completion.
  Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
  String[] toAddresses = new String[] {a.CreatedBy.Email};
  mail.setToAddresses(toAddresses);
  mail.setSubject('Batch Apex for Territory Assignment Bulk : ' + a.Status);
  mail.setPlainTextBody('The batch Apex job processed ' + a.TotalJobItems +
  ' batches with '+ a.NumberOfErrors + ' failures.');
  Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
 
 }

 webservice static String BatchApexMethod(String objectType)
 {
  BatchApexTerritoryAssignmentBulk leadBulk = new BatchApexTerritoryAssignmentBulk();
  BatchApexTerritoryAssignmentBulk accBulk = new BatchApexTerritoryAssignmentBulk();

  try
  {
 
  if(objectType == 'Lead')

   leadBulk.query = 'Select Id, Name, Company, Keep_in_Territory__c, LastName, Status, isConverted, Segment__c, Sub_Segment__c, Postalcode, Potential_Revenue__c From Lead where isConverted = false';
  
   System.Debug('QUERY' + leadBulk.query);
  
  Id leadProcessId = Database.executeBatch(leadBulk);
 
  batchId = leadProcessId;
 
 

  /*if(objectType == 'Account')

   accBulk.query = 'Select Id, Name From Account';
  
  Id accountProcessId = Database.executeBatch(accBulk); */
 
  return '';
  }
  catch(Exception e)
   {
   System.debug('Exception'+e);
   }
   return '';
 
 } 
 
 public static testMethod void BatchApexTerritoryAssignmentBulkTestMethod()
 {
  String objType = 'Lead';
  User usr=[select id,Name from User where Name = 'Vimal Desai'];
  List<Lead> leadlist = new List<Lead>();
  for(integer i = 0; i<200; i++)
  {
   Lead l = new lead(Company='TCS' + 'i',LastName='David',Status='New');
   leadlist.add(l);
  }
  insert leadlist;
 
  Test.StartTest();
 
  BatchApexTerritoryAssignmentBulk batchinstance = new BatchApexTerritoryAssignmentBulk ();
  batchinstance.query = 'Select Id, Name, Company, Keep_in_Territory__c, LastName, Status, isConverted, Segment__c, Sub_Segment__c, Postalcode, Potential_Revenue__c From Lead where isConverted = false LIMIT 200';
  BatchApexMethod(objType);
  ID batchprocessid = Database.executeBatch(batchinstance);
 
  Test.StopTest();
 
 }
 
 
 
 
 
 
 //public void batchJobStatus_Processes()
 //{
 //AsyncApexJob aaj;
 
 //aaj =  [select Id,JobItemsProcessed from AsyncApexJob where Id =: batchId];
 //no_jobs_processed = aaj.JobItemsProcessed;
 
 //}
 
 
 
 
}

 

 

 

 

 

 

Hi,

 

I just want to use contact fields as merge fields in 'Static Recource'.  Is it possible to access from static resource? Could you onyone please give some good solution?

 

Thanks for ur solution.

 

Regards

Siva

 

 

HI,

 

I want to check Current logged user's role with values of a Multi-picklist field in the Apex ?

can anyone tell me idea to do? Thanks...

 

 

HI, I want to retrieve a word document stored in Document object. I want to use into Visualforce page.

Anyone please tell me a solution for this ?

 

Hi Everyone,

 

 

I would like to check logged user role with a role of particular record owner. If logged user role is on top of the record owner user role then I would like to show a visualforce page. any idea How to do that it very simply ?

 

Thanks in advance !

We use Third party call center tool . I use OpenCTI to update the calldata once a call is completed . I included all the library files but the following SaveLog not at all getting called hence Account record is not created.

    var callback = function (response) {
            if (response.result) {
                      alert(response.result);
               } else { 
                      alert(response.error);
               }
           }
     sforce.interaction.saveLog('Account','Name=NewAccountName&Phone=4155551212',callback);

I included the following script in the top of the visualforce.
     <apex:includescript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />
    <apex:includescript value="/support/console/33.0/integration.js" />
    <apex:includeScript value="{!URLFOR($Resource.cnx__CnxSfdcResources,'js/ConnectsIntegrationAPI.min.js')}"/>
    <apex:includescript value="/soap/ajax/33.0/connection.js" />
    <apex:includescript value="/support/api/33.0/interaction.js" />
  
In the Console, It does not return any message.
Any help much appreciated.
 

I've used the Debug Logs in the past without any issue, so it's strange that this would pop up seemingly overnight.  No Users or Apex classes that I try to log are showing up in my Debug Log history.  I know something is happening because the user I'm trying to log is making changes to records that aren't being captured in debug logs.

This is a huge issue for us as I effectively can't continue development without being able to see what I'm doing!  Any advice is appreciated, thanks!


Eulogio

Hello Everyone,

I have custom vf page in the interaction log of the console as a console component on the specific page layout which is assigned to the record type.

When i save the case in the console the record type will change to the record type to which i have the custom interaction log and the interaction log is not appearning. But if i close the case from the console and reopen then i'm able to see the log.

Could you please help me how can i see the CLI as soon as i save the record.

Thank You,

Regards,
Sharath
Hi Folks,

If a string contains atleast one chinese character then i have return a boolean. I am looking for exact regular expression to use in pattern.matches method.

Any help much appreciated.
 
I have a quick Action button which is overridden with vf page on Case feed. Once I fill all the information and click Submit, it gets redirected to standard case feed record page instead of staying on Service console.

I call the following javascript method in action function:
oncomplete="Sfdc.canvas.publisher.publish({name : 'publisher.refresh', payload : {refresh: true }});"

I also tried the following but it does not work.
oncomplete="Sfdc.canvas.publisher.publish({name : 'publisher.refresh', payload :{refresh: "true" objectRelatedLists: {}}});"

I want to stay on Service console Once i complete the action. Any help much appreciated.
A simple format call on a datetime is return the wrong value.  A year that should be 2015 is coming back 2016.  Am I missing something?

Here is a simple 3 line code example that demonstrates the problem:
 
// Create a DateTime of December 27, 2015
datetime dtTemp = DateTime.newInstance(2015, 12, 27, 0,0,0);
// Format that Date Time - Should Be; December 27, 2015
String sFormatedDate = dtTemp.format('MMMM d, YYYY');
system.debug('++++++++++++++++++Formatted Date  = ' + sFormatedDate);
// Actual is coming back December 27,2016

 
In our org we currently use the Javascript version of libphonenumber (https://github.com/googlei18n/libphonenumber) to validate and correct phone numbers in the Salesforce UI, storing the library as a static resource and calling it from an override page layout, a simple Visualforce page used for the lead object. Validation works very reliably but takes 2-3 seconds, and the override page can cause some unwanted side-effects. Validation allows users to call leads using the Google-built Click-to-Dial softphone built into our Salesforce instance, something out Support team is trialling for a wider launch.

If we wanted to validate phone numbers in the background, so that they were properly formatted before a user ever saw them in the UI, would one alternative be to use the Java or Python version of the library to write a phone-validation service on Heroku and use Heroku Connect (https://devcenter.heroku.com/articles/herokuconnect) to sync the data with Salesforce?

 

Hi,

 

In the Contact page, I have replaced the New button on Opportunity related list with Cusotm button (Source is URL).

When I create an Opportunity from Contact, The Acount field of Contact is prepopulated . I have one more Account lookup field in Opportunity. I just want to clear the standard Account lookup field of opportunity and want to prepopulate the custom account lookup field.

 

I fetched HTML id and populated the Account Name in custom lookup field in Opportunity but how to clear the standard Account lookup field in Opportunity (I don't want to mention any values in standard account lookup field?

 

Please help me to get a solution .

 

Thanks in advance...

 

 

Hi All,

 

I want to send an email with the selected Attachment from Notes and Attachment related list....

 

i.e. i have some file inside Notes and Attachment related list.. and i want to select one file out of them.. and want to email that with some template.. please let me kow how can i do that...

 

 

Thanks

Hello All, How can we retrieve the delegated administration information in Salesforce. Actually in my case, the Delegated admins should not be allowed to set a particular value. I like to do it in validation rule. If it is not possible in validation rule, then I'm okay with trigger. Can anybody have any ideas? Thanks for your assistance in advance. Regards Siva

Hi there,

 

I want to know if it's possible to check if the current user's Role is higher than another user's role through Apex. Is this possible? Thanks.

 

Sanch

  • October 21, 2010
  • Like
  • 0

Hi,

My requirement is like that...

I want to delete records from a custom object based on a criteria (if a checkbox is checked). This record is also holding some attachments. But before delete the Same record should be inserted into another Custom object  along with the attachments.(this object is also configured like this.)

 

I don't know why my code is not working. I 'm new to the world of trigger. Please help me.

 

 

trigger DeleteInvoicePopulatePSR on Invoice_holder__c (after Insert)
 {
  List <Invoice_holder__c> selectedInvoice= new List<Invoice_holder__c>([select Id,Amount_Open__c,name,Credits__c,Debits__c,Doc_Number__c,Due_Date__c,Order_Date__c,Paid_date__c,Payment_Referance__c,Purchase_Order__c,Sales_Order_No__c,Transaction_Type__c, (Select Id From Attachments)
   from Invoice_holder__c where ID IN:Trigger.newMap.keySet()and Seven_Years_Old__c=true]);
  List <PSR_clone__c> psrInsert=new List<PSR_clone__c>();
  List <Attachment> attlist=new List<Attachment>();
  List <Invoice_holder__c> ToBeDeleted=new List<Invoice_holder__c>();
  
   for(Invoice_holder__c i:selectedInvoice)
       {
        PSR_clone__c psrCloneInsert=new PSR_clone__c();
            psrCloneInsert.Amount_Open__c=i.Amount_Open__c;
            psrCloneInsert.Credits__c=i.Credits__c;
            psrCloneInsert.Debits__c=i.Debits__c;
            psrCloneInsert.Doc_Number__c=i.Doc_Number__c;
            psrCloneInsert.Due_Date__c=i.Due_Date__c;
            psrCloneInsert.Paid_date__c=i.Paid_date__c;
            psrCloneInsert.Transaction_Type__c=i.Transaction_Type__c;
           psrInsert.add(psrCloneInsert);
          for(Attachment att:i.Attachments )
           {
             att.parentId=psrCloneInsert.ID;

             attlist.add(att);
            }
         
         
   }
    Insert psrInsert;
    Insert attlist;
    Delete selectedInvoice;
   }

I couldn't capture and display the options selected in the visualforce page. I include my controller and visualforce page. Intent is a custom object. Everything looks fine, don't know what i am missing.

 

 

public class intent{

String[] intent;

public String[] getintent(){
       return intent;
}

public void setintent(String[] intent){
        this.intent = intent;
}

public list<SelectOption> getintents(){

    list<Intent__c> custintents = new list<Intent__c>();
    custintents = [SELECT Name FROM Intent__c order by CreatedDate ASC];
    
    List<SelectOption> options = new List<SelectOption>();
    
    for(Intent__c custintent : custintents){
        options.add(new SelectOption(custintent.Name,custintent.Name));
    } 
    return options;
}

public PageReference Next(){ 
    return null;

}

}

 

<apex:page controller="intent">
<apex:form id="form1">
    <apex:selectCheckboxes value="{!intent}" onselect="{!intent}">
        <apex:selectOptions value="{!intents}"> </apex:selectOptions>
    </apex:selectCheckboxes>
    <apex:commandButton action="{!Next}" value="Next" reRender="out" status="status"/>
</apex:form> 

<apex:outputPanel id="out">
        <apex:actionstatus id="status" startText="testing...">
            <apex:facet name="stop">
                <apex:outputPanel >
                    <p>You have selected:</p>
                    <apex:dataList value="{!intent}" var="c">a:{!c}</apex:dataList>
                </apex:outputPanel>
            </apex:facet>
        </apex:actionstatus>
    </apex:outputPanel>
       
</apex:page>

 

 

 

  • July 29, 2010
  • Like
  • 0

This is more of a best practice type question. For a long time, I had a seperate testing class for every trigger/component/class. This got to be kinda bulky, and I found I was repeating a lot of code (lots of triggers revolved around creating the same types of objects, so many of my testing classes where essentially the same thing, save a few asserts). So I thought it would make sense to combine all my testing classes into one massive test class. Easier to maintain (from my point of view), and made it so I just created my test objects, ran my various asserts and coudl easily test all my code.

 

Now of course, that idea is failing. I have to create too many objects, and run too many different tests for them all to be contained in one file. But the fact that there is a lot of shared code is still true. So now I'm thinking about breaking it into testing classes by the object they test. I'm really fairly new to OOP, so I know there is a more eloquent way of doing it, probably creating some basic classes, and extend them for the various objects I need to test or something. Before I do another rewrite though I just wanted to see how the community does it. Thanks for any insight.

Hi,

 

We have custom Customers Object, in which we have a record type that stores the customer location. For this we are storing the corresponding  customer ID in a custom lookup field for customer location record.

 

we are showing  the customer location records in the related list of the customer object. we are creating the customer location record using  a custom button in the related list , for this button click we are  passing recordtype=recordtypeid in the url , so that the page navigates to the customerlocation record type by default.

 

The problem , we need to pre-populate the parent customer id for the corresponding customer location record.

In the salesforce documentation it was given that if we pass the html id of the lookup fields in the query string , the values will be populated automatically.

 

e?CF00NA000000248R5=C-1689&CF00NA000000248R5_lkid=a0MA0000000h8UN&RecordType=012A0000000DDSvIAO&retURL=/a0MA0000000h8UN

 

This is working fine with in an Specific Org, but if we move the code into another org, the html id of the lookup wont be the same , and the lookup is not populating. 

 

Any ideas on how to proceed on this ?

 

Thanks,

yvk431

 

I have some code that sends out an email. If I run that code from inside salesforce it works fine. However, if I run that code as the public sites user I get the following SendEmailResult error.

 

SendEmail failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []

 

However, all the mailing objects ID's (who, what, template and orgwide) are exactly the same when I send it from inside salesforce and from the website so I don't understand how it could be giving an error in one case but not the other.

 

 Here's the code that sends the email:

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 

mail.setTemplateId(template);

mail.setwhatId(what);

mail.setTargetObjectId(who);

mail.setSaveAsActivity(true);

mail.setOrgWideEmailAddressId(orgwide);

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail});

 

for(Messaging.SendEmailResult res : r){

if(res.isSuccess() == false)

System.debug(res.geterrors().get(0).getMessage());

}

 

 Am I misunderstanding the error or is there some other ID field that could be screwing up the email?

 

 

Message Edited by grigri9 on 11-17-2009 09:08 PM