• Sam Alex
  • NEWBIE
  • 45 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 22
    Replies

Hi,

When retrieving data from the php toolkit we need to specify what columns we need. Is there way to get all the columns from an object?

Please advice. Thanks in advance.

Hi,

Is there a way to display the field names in the page? Like in Contact Object we have FirstName. But in interface we see the label.

Please help. Thanks

Hi All,

I have added a check box called "ValidateEmail" to Contact Object. When "ValidateEmail" is TRUE I want the before update and before insert trigger to check whether the EMAIL (field on Contact object) is empty or not.

If the "ValidateEmail" is TRUE and EMAIL is empty I dont want to add/update that record. Instead I want to show a validation error message. If the "ValidateEmail" is FALSE I dont want that validation.

How can I do this?

Any Help? Thanks in advance.

Hi,

I want to get the First Name of the Contact Object. When I go to the Contact Objects Fields, they only have a field called NAME. NAME is a combination of (PreFix, First Name and Last Name). 

Is there a way to access the First Name of that conatct from apex code?

Please Help me.

Thanks in advance.

Hi,

I want to get the Account.Name from the Account object from the Contact (before insert) Trigger. 

1. I fill Contact details
2. I select the Account

Then I fire my trigger. My trigger is for Contact object. 

I have the Contact object details

Contact[] cont = Trigger.new;

 

I tired to access the Account.Name related to this Contact by

cont.Account.Name
But it returns NULL.

Please Help me.

Thanks in advance

Hi All,

I Have a trigger for Contact Object. It sends a HTTP request to external Host. For this request I want to get the, First Name, Last Name and Account Name of that Contact.

In the Contact Object
1. User Name is a combination of PREFIX, FIRST NAME and LAST NAME. 
2. Contact is added under an Account and I want to get the Name of the Account (which was selected when the Contact creation)

This is my Trigger,
 

Contact[] cont = Trigger.new;
    
    for (Contact c :cont){
        myRequestSendingClass.sendRequest(c.Account.Name, c.Name);
    }
I tryied to access the Account name by
c.Account.Name
And I tried to accress the Contact name (combination) by
c.Name

But both of them returns NULL.

 

How can I get these values from the Contact object?

Please Help Me. Thankyou in advance.

Hi,

I have a custom object. I have have user email field. When I go to the details of the custom objects record, I want to fill the "User Email" textbox with the email of currently logged in user. (only if the records "User Email" value is empty).

How can I do this?

Thanks in advance.
Hi,

I have a post install script. All I want to do is add a record to a custom object (which comes with the package). In the record that i want to add automatically, I want to get details from the logged in User, and generate a random number.

After install I get the following error.
Unexpected Error	 	The package installation failed. Please provide the following information to the publisher:

Organization Name: xx
Organization ID: xx
Package: xx
Version: 1.0
Error Message: The post install script failed.
What am I doing wrong here? Please help. Thanks in advance.

Below given is my Post Install code
 
global class PostInstallClass implements InstallHandler {
    global void onInstall(InstallContext context) {
        if(context.previousVersion() == null) {
            string userEmail = UserInfo.getUserEmail();
            string firstName = UserInfo.getFirstName();
            string lastName  = UserInfo.getLastName();
            string orgName   = UserInfo.getOrganizationName();
            string recName  = 'MyRec1';
            string uniqueId   = generateRandomString(40);
            
           MyCustomObject__c c = new MyCustomObject__c(UniqueID = uniqueId, Your_Company__c = orgName, Name = recName, First_Name__c = firstName, Last_Name__c = lastName, Email__c = userEmail);
            insert c;
       }
    }

public static String generateRandomString(Integer len) {
        final String chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
        String randStr = '';
        while (randStr.length() < len) {
           Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), 62);
           randStr += chars.substring(idx, idx+1);
        }
        return randStr;
    }

}
Hi,

I have a post install script. All I want to do is add a record to a custom object (which comes with the package). In the record that i want to add automatically, I want to get details from the logged in User, and generate a random number.

After install I cannot see my the record which should be added with the post install script. The Test I did with test classes says its PASS. Here is my Post Install class. What am I doing wrong here? Please help. Thanks in advance.


global class PostInstallClass implements InstallHandler {
    global void onInstall(InstallContext context) {
        if(context.previousVersion() == null) {
            string userEmail = UserInfo.getUserEmail();
            string firstName = UserInfo.getFirstName();
            string lastName  = UserInfo.getLastName();
            string orgName   = UserInfo.getOrganizationName();
            string recName  = 'MyRec1';
            string uniqueId   = generateRandomString(40);
            
           MyCustomObject__c c = new MyCustomObject__c(UniqueID = uniqueId, Your_Company__c = orgName, Name = recName, First_Name__c = firstName, Last_Name__c = lastName, Email__c = userEmail);
            insert c;
       }
    }

public static String generateRandomString(Integer len) {
        final String chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
        String randStr = '';
        while (randStr.length() < len) {
           Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), 62);
           randStr += chars.substring(idx, idx+1);
        }
        return randStr;
    }

}
Hi,

I have a app packaged. When I install it in a different user, after install is completed, I want to redirect the user to a apex page (also packaged with the app).

How to trigger that even after app installation is completed?

Thanks in advance.
Hi,

I have added a 4 custom fields to Account object. Then I have edited the current layout and add those 4 custom fields as a new section called "Account Sub Info". Now I want to package my 4 custom fields and the "Account Sub Info" section.

Means when user installs my package I want my custom fields and "Account Sub Info" section added to their Account layout.

How can I do this?

When packaging I tried to package the "Account Layout". When I try to install it it says the follwing.

Duplicate Name         The name "NewOpportunity" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "NewNote" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "NewTask" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "NewContact" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "NewCase" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "Account-Account Layout" is already used on component type: Page Layout. Please rename existing component.
Duplicate Name         The name "NewEvent" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "LogACall" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "Account.Billing" is already used on component type: Custom Button or Link. Please rename existing component.


Please Help and guide me how can I achive my requirement.

Thanks in advance...
Hi,

I want to iterate though the records of Account object inside a trigger of another Object. I tried to do it as follows,

trigger CCTriggerToUpdateAccounts on CC__c (before insert, before update) {
    List<Account> accountList = [SELECT MyField__c FROM Account];
    CC__c[] configs = Trigger.new;
    
    for (Configuration__c c :configs){
        for(Account a: accountList){
            a.Sync_to_AG__c = c.CCID__c;
        }
        update accountList;
    }
}

It works. But The Account iteration goes for several times. I only have 1 Account in my list. 

How can I make it to iterate according to the number of records in the Account object?

Please Help me. Thank you very much in advance.
 
Hi,

I have a field in Account object (which I have added). Lets say it is "Show_ID_in_acc". Every account has this check box.

Now I have a custom object called "Settings". In Settings object I have a check box called "Show_ID_in_settings". 

If I enable (check) the "Show_ID_in_settings" in my custom object I want to display the "Show_ID_in_acc" in Account detail page. If i uncheck the "Show_ID_in_settings", I dont want to see the "Show_ID_in_acc" in Account detail page.


It is like I have a Global switch in my custom object where I can turn off all "Show_ID_in_acc" in Account detail pages.


How can I do this?

Please help me.

Thanks in advance.
I have a custom object with several text fields and a checkbox, My checkbox label is "Allow update".

I want to show that checkbox in a section of ACCOUNT object (non custom build object). Means, I want to have a section in Account detail page called "MyCustomObjectName" and that section should have the "Allow update" checkbox.

Problem I have is to relate these 2 object. It is not lookup, hierarchy or Master-Detail.

Please help me on this...
Hi All, I am very new to Salesforce. Please help me on this.

I have a custom Object call "Book". I wrote a class. It has function call "sendRequest"

public static void sendRequest(Book__c[] books){
        string url = myUrl;
        
        for (Book__c b :books){
            //url += '?bookPrice='+ b.Price__c;
            
            HttpRequest req = new HttpRequest();
            HttpResponse res = new HttpResponse();
            Http http = new Http();
            
            req.setMethod('POST' ); // Method Type
            req.setEndpoint(url); // Server Url
            
            req.setHeader('Content-Type', 'application/x-www-form-urlencoded'); // Content Type
            req.setBody('bookPrice=' + EncodingUtil.urlEncode('testValue', 'UTF-8')); // Request Parameters
            
            try {
                res = http.send(req);
                if(res.getBody() != null){
                    // Parse Response
                }
            } catch(Exception e) {
                System.debug('error: '+ e);
            }
        }
    }

Then I wrote a trigger. 


trigger BookRackTrigger on Book__c (after insert) {     
Book__c[] books = Trigger.new;     
BookRack.sendRequest(books);
}

Now when I am adding a Book, after clicking "save" I want to send a request to myURL. But it it not receiving any request. I have added myURL to remote site list as well.

What am I doing wring here? lease help me.
 
Hi all,

I want to have a special Trigger.

When I am saving data of a custom object my Trigger triggers. At that place I want to send a CURL request to another server and get a response. Response is basically validation.

Based on the validation response I want to display error messege in SalesForce interface.

1. Can I send CURL request with JSON to another server with Apex?
2. Once I get the JSON response can Apex decode it show errors (if available) OR add record in SalesForce side?

Please Help. Thanks.
Hi,

I want to iterate though the records of Account object inside a trigger of another Object. I tried to do it as follows,

trigger CCTriggerToUpdateAccounts on CC__c (before insert, before update) {
    List<Account> accountList = [SELECT MyField__c FROM Account];
    CC__c[] configs = Trigger.new;
    
    for (Configuration__c c :configs){
        for(Account a: accountList){
            a.Sync_to_AG__c = c.CCID__c;
        }
        update accountList;
    }
}

It works. But The Account iteration goes for several times. I only have 1 Account in my list. 

How can I make it to iterate according to the number of records in the Account object?

Please Help me. Thank you very much in advance.
 
Hi,

I want to get the First Name of the Contact Object. When I go to the Contact Objects Fields, they only have a field called NAME. NAME is a combination of (PreFix, First Name and Last Name). 

Is there a way to access the First Name of that conatct from apex code?

Please Help me.

Thanks in advance.

Hi,

I want to get the Account.Name from the Account object from the Contact (before insert) Trigger. 

1. I fill Contact details
2. I select the Account

Then I fire my trigger. My trigger is for Contact object. 

I have the Contact object details

Contact[] cont = Trigger.new;

 

I tired to access the Account.Name related to this Contact by

cont.Account.Name
But it returns NULL.

Please Help me.

Thanks in advance
Hi,

I have a post install script. All I want to do is add a record to a custom object (which comes with the package). In the record that i want to add automatically, I want to get details from the logged in User, and generate a random number.

After install I get the following error.
Unexpected Error	 	The package installation failed. Please provide the following information to the publisher:

Organization Name: xx
Organization ID: xx
Package: xx
Version: 1.0
Error Message: The post install script failed.
What am I doing wrong here? Please help. Thanks in advance.

Below given is my Post Install code
 
global class PostInstallClass implements InstallHandler {
    global void onInstall(InstallContext context) {
        if(context.previousVersion() == null) {
            string userEmail = UserInfo.getUserEmail();
            string firstName = UserInfo.getFirstName();
            string lastName  = UserInfo.getLastName();
            string orgName   = UserInfo.getOrganizationName();
            string recName  = 'MyRec1';
            string uniqueId   = generateRandomString(40);
            
           MyCustomObject__c c = new MyCustomObject__c(UniqueID = uniqueId, Your_Company__c = orgName, Name = recName, First_Name__c = firstName, Last_Name__c = lastName, Email__c = userEmail);
            insert c;
       }
    }

public static String generateRandomString(Integer len) {
        final String chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
        String randStr = '';
        while (randStr.length() < len) {
           Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), 62);
           randStr += chars.substring(idx, idx+1);
        }
        return randStr;
    }

}
Hi,

I have a post install script. All I want to do is add a record to a custom object (which comes with the package). In the record that i want to add automatically, I want to get details from the logged in User, and generate a random number.

After install I cannot see my the record which should be added with the post install script. The Test I did with test classes says its PASS. Here is my Post Install class. What am I doing wrong here? Please help. Thanks in advance.


global class PostInstallClass implements InstallHandler {
    global void onInstall(InstallContext context) {
        if(context.previousVersion() == null) {
            string userEmail = UserInfo.getUserEmail();
            string firstName = UserInfo.getFirstName();
            string lastName  = UserInfo.getLastName();
            string orgName   = UserInfo.getOrganizationName();
            string recName  = 'MyRec1';
            string uniqueId   = generateRandomString(40);
            
           MyCustomObject__c c = new MyCustomObject__c(UniqueID = uniqueId, Your_Company__c = orgName, Name = recName, First_Name__c = firstName, Last_Name__c = lastName, Email__c = userEmail);
            insert c;
       }
    }

public static String generateRandomString(Integer len) {
        final String chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
        String randStr = '';
        while (randStr.length() < len) {
           Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), 62);
           randStr += chars.substring(idx, idx+1);
        }
        return randStr;
    }

}
Hi,

I have added a 4 custom fields to Account object. Then I have edited the current layout and add those 4 custom fields as a new section called "Account Sub Info". Now I want to package my 4 custom fields and the "Account Sub Info" section.

Means when user installs my package I want my custom fields and "Account Sub Info" section added to their Account layout.

How can I do this?

When packaging I tried to package the "Account Layout". When I try to install it it says the follwing.

Duplicate Name         The name "NewOpportunity" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "NewNote" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "NewTask" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "NewContact" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "NewCase" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "Account-Account Layout" is already used on component type: Page Layout. Please rename existing component.
Duplicate Name         The name "NewEvent" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "LogACall" is already used on component type: Action. Please rename existing component.
Duplicate Name         The name "Account.Billing" is already used on component type: Custom Button or Link. Please rename existing component.


Please Help and guide me how can I achive my requirement.

Thanks in advance...
Hi,

I want to iterate though the records of Account object inside a trigger of another Object. I tried to do it as follows,

trigger CCTriggerToUpdateAccounts on CC__c (before insert, before update) {
    List<Account> accountList = [SELECT MyField__c FROM Account];
    CC__c[] configs = Trigger.new;
    
    for (Configuration__c c :configs){
        for(Account a: accountList){
            a.Sync_to_AG__c = c.CCID__c;
        }
        update accountList;
    }
}

It works. But The Account iteration goes for several times. I only have 1 Account in my list. 

How can I make it to iterate according to the number of records in the Account object?

Please Help me. Thank you very much in advance.
 
Hi,

I have a field in Account object (which I have added). Lets say it is "Show_ID_in_acc". Every account has this check box.

Now I have a custom object called "Settings". In Settings object I have a check box called "Show_ID_in_settings". 

If I enable (check) the "Show_ID_in_settings" in my custom object I want to display the "Show_ID_in_acc" in Account detail page. If i uncheck the "Show_ID_in_settings", I dont want to see the "Show_ID_in_acc" in Account detail page.


It is like I have a Global switch in my custom object where I can turn off all "Show_ID_in_acc" in Account detail pages.


How can I do this?

Please help me.

Thanks in advance.

Apex script unhandled trigger exception by user/organization: 005U0000000IWs4/00DU0000000JDvW

 

AssociateSection: execution of BeforeUpdate

 

caused by: System.CalloutException: Callout from triggers are currently not supported.

 

Trigger.AssociateSection: line 58, column 1

 

Is there a work around for adding an HTTP post inside a trigger? Apex Classes??

 

Thanks!