• Jaffer Ali.
  • NEWBIE
  • 25 Points
  • Member since 2012

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

I have custom object called payment and its parent is the standard object contact.  I am writing a trigger after insert of 'payment' object to update a field on the contact object.  I am able to get the payment object after insert in the trigger and also update it's properties but when i try to access the parent object (contact)  I am umable to what should the apex code for this look like.

 

trigger newPaymentTrigger on Payment__c (after insert) {    

Payment__c payment = [SELECT Id FROM Payment__c WHERE Id IN :Trigger.new];    

update payment;        

//Contact contact = [SELECT Id FROM Contact WHERE Id = :payment.Contact__c];

}

 

The commented line does not work because payment.Contact__c is null

 

The relation ship between the 2 objects is look up relation ship.

Hello all,

I have whitelisted CORE orgin (https://maxcdn.bootstrapcdn.com) from salesforce but still getting the below error in javascript Console. If any one knows how to resolve it, then it would be great.

'https://maxcdn.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.woff' from origin 'https://maxcdn.bootstrapcdn.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://c.cs5.visual.force.com' is therefore not allowed access. The response had HTTP status code 403.

Thats how Im reffering the bootstrapcdn.
<link href="https://netdna.bootstrapcdn.com/font-awesome/2.0/css/font-awesome.css" rel="stylesheet"/>


Thanks
Jaffer
Hey guys,

I got a critical case, as present below.

Problem:
In one of my objects there are five long text area fields. I want to perform search on those fields and update all records , once it is done. My expected result set contains 600 thousand records.

My Solution:
I created a btach class to perform this task, as Like statement is not allowed for long text area so I am scanning all records and then using "contains" function in apex to see if it is matched.Right now, it is taking 45 minutes to complete that job for 100 thousand records which is really too long.

Is there any other way I can make this process faster. Need suggestions.

I have included Chineese and english in translation workbech for one of my organizations. Is there a way to access active languages name in Apex Code ?

 

Thanks

Jaffer

Hello Every One,

 

I am thinking to resolve one mystery in Apex which I don't know why it is happening like that.Please consider two sample code . I am getting total number of script statement equal to 101 in both piece of code .For first one it makes sense to me but not sure why it is giving 101 in second sample code.

 

Sample 1

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

for(Integer i=0 ;i < 100 ;i++){


}

 

Sample 2 

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

for(Integer i=0 ;i < 100 ;i++){


    System.debug('My name is Jaffer');
}

 

 

Please share your thoughts.

 

Thanks

Jaffer

Is there a way to identify all controlling and dependent values in a multi select picklist.

 

For Example :

There are two picklist 

        1)  Type has values ( Newspaper , Internet)

        2)  Content ( Good, Bad , Excellent)

 

Following are their dependencies.

NewsPaper  Good , Bad

Internet   Good , Bad, Excellent

 

How I am going to identify that What are the controlling values for Good and Bad?

 

Thanks,

 

Jaffer

Hello all,

I have whitelisted CORE orgin (https://maxcdn.bootstrapcdn.com) from salesforce but still getting the below error in javascript Console. If any one knows how to resolve it, then it would be great.

'https://maxcdn.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.woff' from origin 'https://maxcdn.bootstrapcdn.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://c.cs5.visual.force.com' is therefore not allowed access. The response had HTTP status code 403.

Thats how Im reffering the bootstrapcdn.
<link href="https://netdna.bootstrapcdn.com/font-awesome/2.0/css/font-awesome.css" rel="stylesheet"/>


Thanks
Jaffer
Hey guys,

I got a critical case, as present below.

Problem:
In one of my objects there are five long text area fields. I want to perform search on those fields and update all records , once it is done. My expected result set contains 600 thousand records.

My Solution:
I created a btach class to perform this task, as Like statement is not allowed for long text area so I am scanning all records and then using "contains" function in apex to see if it is matched.Right now, it is taking 45 minutes to complete that job for 100 thousand records which is really too long.

Is there any other way I can make this process faster. Need suggestions.

I have included Chineese and english in translation workbech for one of my organizations. Is there a way to access active languages name in Apex Code ?

 

Thanks

Jaffer

Hi,

 

I am running below query

 

SELECT account.name, account.partner_sales_person__c, account.crm_product__r.name, name, (select whoid, whatid from tasks where subject = 'DEMO') FROM contact WHERE account.partner_sales_person__c in ('clouddev')  AND account.crm_product__c != null and name like '%gore'

  and getting 2 records as shown.

 

Tasks	Name	Account

Tasks	Stephen Gore	Account
-----                   --------
	Steve Gore	Account
                        --------

 

Current relation is

 

Account 'XXX' has 2 contacts (Stephen Gore, Steve Gore) and only 'Stephen Gore' has Task DEMO created so I don't need 'Steve Gore' record as it has no task attached to it.

 

Please reply,

 

Thanks,

 

Clouddev

 

 

 

 

Hello Every One,

 

I am thinking to resolve one mystery in Apex which I don't know why it is happening like that.Please consider two sample code . I am getting total number of script statement equal to 101 in both piece of code .For first one it makes sense to me but not sure why it is giving 101 in second sample code.

 

Sample 1

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

for(Integer i=0 ;i < 100 ;i++){


}

 

Sample 2 

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

for(Integer i=0 ;i < 100 ;i++){


    System.debug('My name is Jaffer');
}

 

 

Please share your thoughts.

 

Thanks

Jaffer

Hi All,

 

I am trying to work through creating a trigger that will create a new record in a different object, when a specific stage is reached. For example, when the Stage=signed and InternalApp=true on the Application__c object we want it to trigger the creation of a record on a different object.

 

Most of the triggers I see are creating records, on the insertion of another record. Can someone point me in the right direction for a trigger based off an update of another record?

 

Thanks for your help.

 

Alix

HI

 

I have three lookup fields

1.Sales 

2.Account

3.Contact 

While creating a record if I select sales lookup field , I need to populate account and contact lookup field based on the sales record selected

 

Please help me on this.

 

Thanks

 

 

Hi,

 

I have the situtation like i have some contries with command links in vf page.

If i click on this country in the below select list only the states particular to that county has to show.

How can we achieve this any idea.

 

It is very urgent.......................

 

Thanks,

Bujji

  • September 10, 2012
  • Like
  • 0

I have custom object called payment and its parent is the standard object contact.  I am writing a trigger after insert of 'payment' object to update a field on the contact object.  I am able to get the payment object after insert in the trigger and also update it's properties but when i try to access the parent object (contact)  I am umable to what should the apex code for this look like.

 

trigger newPaymentTrigger on Payment__c (after insert) {    

Payment__c payment = [SELECT Id FROM Payment__c WHERE Id IN :Trigger.new];    

update payment;        

//Contact contact = [SELECT Id FROM Contact WHERE Id = :payment.Contact__c];

}

 

The commented line does not work because payment.Contact__c is null

 

The relation ship between the 2 objects is look up relation ship.

Hi there

 

I read in many places that you're advised to turn off workflows before you do a data migration.

 

Why is that? - I'm sure it's for performance reasons.  But, why would one want to turn off workflow?

 

For example, when I create a new Lead (through the SF frontend) I would want the workflow to generate an email to be sent to the lead owner which I have specified in the lead edit window.

 

Why would I want to suppress the workflow if I'm using an import file instead, say to import 15 leads?

 

I want to understand the philosophy behind that - I understand there are times when people need to import 300000 records and so they want to speed things up.  But if you deactivate the workflow, then when will you go back and do the jobs that you have your workflows designed to do?

 

Thanks

King

 

Hi,

 

I have a  strange thing going on.  When I am on CS13 (Sandbox) and I perform  a System.debug(System.Now()); it returns a time of 20:42 (8:42pm) and the actual time here is 4:42pm!  If my ORG is setup to be on the New York East Coast then why wouldn't the Sytem.Now() command return the correct time?

 

I am using this javascript with a hard coded expected date/time and it is throwing my results off and the above is why I think it is.

  • September 08, 2012
  • Like
  • 0

HEllo I was wwondering how i can get my XML response from Salesforce to Include the Id where it errors out?

 

I get the Id when it is a success for each success but not for errors? I am running my process through Pervasive..

HI, this is my first trigger. Kindly tell me what mistake am doing?

 

1. The problem is : Every time this trigger is executed the record gets inserted twice...

 

How to stop this?

 

Please find the code below:

trigger SalesOrder on Sales_Order__c (after update){

    List <Sales_Order_Status_History__c> sosh = new List<Sales_Order_Status_History__c>();
    if(Trigger.isafter){
        for(Sales_Order__c  so : Trigger.new){
            if(so.Sales_Order_Status__c == 'Order Acknowledgement'){
                sosh.add(new Sales_Order_Status_History__c(Status__c = so.Sales_Order_Status__c, SO_No__c = so.Name,Record_Created_Date__c=so.createdDate,Last_Modified_Date__c=so.systemModStamp,Record_User__c=userinfo.getUserName()));   
                insert sosh;     
            }
            else if(so.Sales_Order_Status__c == 'Customer Inputs'){
                sosh.add(new Sales_Order_Status_History__c(Status__c = so.Sales_Order_Status__c, SO_No__c = so.Name,Record_Created_Date__c=so.createdDate,Last_Modified_Date__c=so.systemModStamp,Record_User__c=userinfo.getUserName()));   
                insert sosh;
            }
            else if(so.Sales_Order_Status__c == 'Scheduling'){
                sosh.add(new Sales_Order_Status_History__c(Status__c = so.Sales_Order_Status__c, SO_No__c = so.Name,Record_Created_Date__c=so.createdDate,Last_Modified_Date__c=so.systemModStamp,Record_User__c=userinfo.getUserName()));   
                insert sosh;
            }

}}}

Please help

hi,

 

we have an arabic client and try to generate a document with both english and arabic content. in our browsers, we can see both languages, however the generated PDF only contains the english content, whereas the arabic content is empty.

 

this happens in both cases, when using arabic text directly (copy paste from a text editor) or when converting the arabic text first to html entities.

 

 

 

is arabic not supported or do we have to instruct the renderer in some special way to support arabic?


 






<apex:page renderAs="PDF">

<head>
<style type="text/css">
@page {
size: 21.0cm 29.7cm;
margin-top: 2.0cm;
margin-left: 0cm;
margin-right: 1.5cm;
margin-bottom: 2cm;
}
</style>
</head>

<body>

Copy paste:<br/>
غير ذلك(الرجاء التوضيح)

<br/><br/>
HTML Entities:<br/>
&#1594;&#1610;&#1585;&#1584;&#1604;&#1603;

</body>
</apex:page>



 

  • March 24, 2009
  • Like
  • 0
I am having issues using the immediate attribute within actionSupport. The documentation says that "If set to true, the action happens immediately and any field validation rules are skipped." It doesn't mention anything about rerendering or data binding so I'm a little confused. Here is my problem:

I have a select list of contacts. When a contact is selected, a form with inputFields is rerendered to display the data of the selected contact. Some of these fields are required. If a field is null and you try to select a different contact you get an error message that the field is required. This is no good, so I added the immediate attribute to the actionSupport but now it does not appear to be rerendering the form.

Any ideas, suggestions?

Page:
Code:
<apex:page controller="input" >

<apex:form >
  <apex:selectList value="{!contactID}" size="5">
     <apex:selectOptions value="{!contacts}" />
     <apex:actionSupport event="onchange" action="{!updateContact}" rerender="form" immediate="true"/>
  </apex:selectList>
  <apex:pageBlock >
     <apex:panelGrid columns="2" id="form">
        Full Name: <apex:outputField value="{!c.Name}"/>
        Email: <apex:inputField value="{!c.Email}" required="true"/>
        Title: <apex:inputField value="{!c.Title}" required="true"/>
        Phone: <apex:inputField value="{!c.Phone}" required="true"/>
     </apex:panelGrid>  
  </apex:pageBlock>
</apex:form>

</apex:page>

Controller:
Code:
public class input {
    public String ContactId {set; get;}
    public Contact c {set; get;}
    private List<SelectOption> contacts;
    private Map<Id,Contact> contactMap = new Map<Id,Contact>();

    public List<SelectOption> getContacts(){
       if(contacts == null){
           Contact [] cons = [select Id, Name, Title, FirstName, LastName, Phone, Email from Contact limit 10];
           contactId = cons[0].Id;
           contacts = new List<SelectOption>();
    
           for(Contact c : cons){
              contacts.add(new SelectOption(c.ID,c.Name));
              contactMap.put(c.Id,c);
           }
       }
       return contacts;
    }
   
    public PageReference updateContact(){
        c = contactMap.get(ContactID);
        return null;
    }      
}