• Navin Soni
  • NEWBIE
  • 114 Points
  • Member since 2015

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 19
    Replies
I am trying to create a button that will open a word doc from the local server. What I was told is that we would fist need it to open the browser and then to open the file... a bit lost on this or even if it is doable.  Thanks
Hi I have the code that worked when the day was bigger than the 10th of a month but when I do it when the date is say the 5th etc it fails because the code doesn't return DD and just returns D (i think this is the problem) I'm guessing the same will happen in January with the month too

{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/37.0/apex.js")}
 
var acc = new sforce.SObject("DOUVersion__c"); 

NULL = " ";

acc.Id = "{!DOUVersion__c.Id}";
acc.RetiredHidden__c = NULL;                  
acc.Retired__c = "true";               
acc.Date_of_Retirement__c = "{!YEAR(TODAY())}-{!MONTH(TODAY())}-{!DAY(TODAY())}"; 

         
result = sforce.connection.update([acc]); 
window.location.reload();

your help would be appreciated
Hello
I have some difficulty in understanding the following

a) Normally apex code & trigger run in system.context
   But How to make the apex code execute in USER Mode?
   if the apex code executing in USER Mode  is called by a trigger, will the trigger also execute in USER Mode?

b) Can a visual force page run in USER Mode instead of system.context , again what changes need to be done and why?

c) By default webservice classes written in apex , rest api execute in what Mode?

d) what is the use of system.RunAs with respect to the above.

I hope I am clear

Thanks
Vandana R
i have a list of data in String form, 
                                    Record Id, Name, Stage Name 
                                    "0067F000005RIcsQAG","Robert","Closed Won" 
                                    "0067F000005RIctQAG","James","Prospecting" 
                                    "0067F000005RIcuQAG","David","Qualification" 
                                    "0067F000005RMDIQA4","Kylie","Closed Won" 
                                    "0067F000005RMDJQA4","Ernie","Closed Won"
                                    
                                    Now, I want help in writing this data into a CSV file using apex and generate that csv file automatically

Any help would be greatly appreciated
Hi there!

I need to code a button action that prints PDF attachments of the the selected objects in a list view.
How can I call to the printer automatically for doing this just by clicking a button?

Thank you!!
I am hoping this is possible. I need to create a Task-like layout to create Services. I would need to customize the fields but I need it to be similar to creating a New Task. The goal is to be able to tie a New Service to an Opportunity. In order to that I want to also create a button on the opportunity layout that pops up and allows user to create a New Service. How to I go about achieving this?
  • January 05, 2017
  • Like
  • 0
Hi,

I am making a custom object that has a generate plan(pdf) button. This object has a related list called where Deliverables__c exist. Deliverables__c is a child object in master detailed relationship to the parent object; Plan__c.

Master Object: Plan__c
Detailed/child object: Deliverables__c
 
For the PDF button I need it to have a similar functionality to Quote object, where each line item of Deliverables__c will be displayed in the PDF. Basically I would need to get information from its related list items from Deliverable__c into this PDF in Plan__c object. How can I do this?
  
Thanks,
Arman 
  • December 19, 2016
  • Like
  • 0
Hello All,
I 'd an issue regarding sending emails using singleemailmessage class. I am trying to send ONLY selected properties over mail.
 If property is not available (Status:Sold) --> Then show error message.
Can anyone can help me!
Thank you.

public void sendRecomProp() {
                     if ( !lRecomProperties.IsEmpty() ) {
               
                newTemplate = new EmailTemplate();
                newTemplate = [SELECT Id,Name,IsActive,Subject,Body,HtmlValue,Folder.Name 
                               FROM EmailTemplate 
                               WHERE (Name LIKE '%RecomProperties%') LIMIT 1];
                
                if ( newTemplate!=null ) {
                    String urlDestino = '';
                   
                    String templateSubject = 'KC Properties - Recommended properties';
                    String templateBody = newTemplate.HtmlValue;
                   
                    templateBody = templateBody.Replace('{!Contact.Name}',( actualContact.Name!=null ) ? actualContact.Name : 'User');
                    templateBody = templateBody + 
                        '<br/>' + '<br/>' + 
                        '<table style="width: 100%; border-spacing: 0px; border-color: red transparent;">';
                   
                    String priceFinal = '';
                    for ( Property__c proppe :lPropiedades ) {
                      
                        templateBody = templateBody + 
                            '<tr>' + 
                                '<td style="padding: 5px; width: 100px;">' + 
                                    '<img width="250" height="150" src="' + ( proppe.FirstReferenceImage__c!=null ? String.ValueOf(proppe.FirstReferenceImage__c) : Label.NoImage ) + '"/>' + 
                                '</td>';
                      
                        priceFinal = ( contactRole=='Renter' ) ? 
                                        ( proppe.PriceToRentEUR__c!=null ? String.ValueOf(proppe.PriceToRentEUR__c) : 'Undefined') : 
                                        ( proppe.PriceToSaleEUR__c!=null ? String.ValueOf(proppe.PriceToSaleEUR__c) : 'Undefined' );
                       
                        templateBody = templateBody + 
                                '<td style="padding: 5px;">' + 
                                    '<b>- Property ID: </b>' + 
                                        '<a href="' + ( proppe.WebReference__c!=null ? String.ValueOf(proppe.WebReference__c) : 'www.kcproperties.com' ) + '">' + 
                                            proppe.Name + 
                                        '</a>' + '<br/>' + 
                                    '<b>- Price: </b>' + priceFinal + '<br/>' + 
                                    '<b>- Area: </b>' + ( proppe.Area__c!=null ? String.ValueOf(proppe.Area__c) : 'Undefined' ) + '<br/>' + 
                                    '<b>- Address: </b>' + ( proppe.Address__c!=null ? String.ValueOf(proppe.Address__c) : 'Undefined' ) + '<br/>' + 
                                    '<b>- Details: </b>' + ( proppe.Beds__c!=null ? String.ValueOf(proppe.Beds__c) : 'Undefined' ) + '<br/>' + 
                                    '<b>- Baths: </b>' + ( proppe.Baths__c!=null ? String.ValueOf(proppe.Baths__c) : 'Undefined' ) + '<br/>' + 
                                    '<b>- Build area (m2): </b>' + ( proppe.BuildArea__c!=null ? String.ValueOf(proppe.BuildArea__c) : 'Undefined' ) + '<br/>' + 
                                '</td>' + 
                            '</tr>';
                    }
                 
                    templateBody = templateBody + 
                        '</table>' + '<br/>' + 
                        'You can visit any property via the link on the Property ID value.' + '<br/>' + '<br/>' + 
                        'Best regards.' + '<br/>' + 
                        'KC Properties team';
                   
                    String[] addressesList = new String[]{actualContact.Email};
                    OrgWideEmailAddress[] lOrgAddresses = new OrgWideEmailAddress[]{};
                    lOrgAddresses = [SELECT Id 
                                     FROM OrgWideEmailAddress 
                                     WHERE (Address LIKE '%kcpropertiesestateagent%') LIMIT 1];
                  
                    Messaging.SingleEmailMessage emailToSend = new Messaging.SingleEmailMessage();
                        emailToSend.SetSubject(templateSubject);
                        emailToSend.SetOrgWideEmailAddressId( !lOrgAddresses.IsEmpty() ? lOrgAddresses[0].Id : null );
                        emailToSend.SetToAddresses(addressesList);
                        emailToSend.SetHtmlBody(templateBody);
                  
                    try {
                        if ( !Test.IsRunningTest() && !lOrgAddresses.IsEmpty() ) {
                            Messaging.SendEmailResult[] resultToSend = Messaging.SendEmail(new Messaging.SingleEmailMessage[]{emailToSend});
                            smsMailingResult = 'The mailing has been completed successfully. '+
                                                 '<a href="/' + actualContact.Id + '" style="color: blue; font-size: 100% !important;">'+
                                                    'Click here to return to the contact detail'+
                                                 '</a>';
                            ApexPages.Addmessage(new ApexPages.Message(ApexPages.severity.CONFIRM,smsMailingResult));
                        }
                    } catch (Exception error) {
                        smsMailingResult = 'An error has occurred, please try again later or contact your administrator. '+
                                             '<a href="/' + actualContact.Id + '" style="color:blue;font-size:100% !important;">'+
                                                'Click here to return to the contact detail'+
                                             '</a>';
                        ApexPages.Addmessage(new ApexPages.Message(ApexPages.severity.ERROR,smsMailingResult));
                        smsMailingResult = '';
                        AUX_Methods.log(Label.ErrorSendingEmail+' - Send Email - '+error.GetMessage());
                    }
                }
            }
        }
  • December 06, 2016
  • Like
  • 0
I am trying to create a button that will open a word doc from the local server. What I was told is that we would fist need it to open the browser and then to open the file... a bit lost on this or even if it is doable.  Thanks
I want to use lookup field in my visualforce page . Can anybuddy help me to achieve that with the controller code
I'm going to call for a rest service to the same salesforce instance to make a dml operation from a future method. In the future method i'm calling to a another webservice and then after i'm going to make that dml operation through the rest service. But i'm getting the "caused by: System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out" error. Is there any way to do that dml operation in the from the future method?
Hi,

I am new to salesforce integation. So, I would like to know I can I integrate salesforce with MT4 trading platform? I have to create Account's record in MT4 once when any account record gets created in salesforce org and vice versa. Please help me.


Thank you in advance.
Archana Patel.
Hi I have the code that worked when the day was bigger than the 10th of a month but when I do it when the date is say the 5th etc it fails because the code doesn't return DD and just returns D (i think this is the problem) I'm guessing the same will happen in January with the month too

{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/37.0/apex.js")}
 
var acc = new sforce.SObject("DOUVersion__c"); 

NULL = " ";

acc.Id = "{!DOUVersion__c.Id}";
acc.RetiredHidden__c = NULL;                  
acc.Retired__c = "true";               
acc.Date_of_Retirement__c = "{!YEAR(TODAY())}-{!MONTH(TODAY())}-{!DAY(TODAY())}"; 

         
result = sforce.connection.update([acc]); 
window.location.reload();

your help would be appreciated
how to restrict user to take numberic input in visualforce page??

i am using  : :" <h1>Amount</h1><apex:input type="number" id="damount" value="{!damount}"    /> " 

it gives error "Expected input type 'text', got 'number' for String data type"
Hello
I have some difficulty in understanding the following

a) Normally apex code & trigger run in system.context
   But How to make the apex code execute in USER Mode?
   if the apex code executing in USER Mode  is called by a trigger, will the trigger also execute in USER Mode?

b) Can a visual force page run in USER Mode instead of system.context , again what changes need to be done and why?

c) By default webservice classes written in apex , rest api execute in what Mode?

d) what is the use of system.RunAs with respect to the above.

I hope I am clear

Thanks
Vandana R
Hello all!
I am attempting to switch the default opportunity list view in Lightning from "recent" to "my open opportunities".  I have created a VF page, and adjusted the tab to show the VF page instead of the default.  I think I'm almost there, but 2 issues.
1.  The page displayed is classic with a lightning header.  I would like it to be displayed as a lightning page.
2.  The displayed list is not "my open opportunities".
my VF page code is as follows:
<apex:page showHeader="true" tabstyle="Opportunity">
<apex:ListViews type="Opportunity" />
</apex:page>

any assistance on this is appreciated.
How to know validity of my salesforce account??

Hello,

 

I have xml string , how do i convert that into JSON format in apex?

are there available any built in functions?

 

Thanks,

Anupama

 

 

 

 

Hi guys,

 

Can you clarify the meaning and execution process of both system mode and user mode?

 

 

Hi,

 

We have a requirement were in we need to fetch datas which are stored in Salesforce objects and we need that to be cached on the VF page instead of the controller.

 

We have actions to be executed based on the data  which we are storing, so we do not want to hit the controller each and every time for verifying the data.

 

Is there an option in Salesforce where in we can put the data in the memory of the page and use those data using Javascript or some other option.

 

Any help would be greatly appreciated.

 

Thanks.

 

Prakash

Hey there. Your help on this one will be greatly appreciated. I am trying to create a custom button on my contact pages  to do the following:

1. Create new task to process members cc information
2. The task will have basic contact information already populated from contact record
3. An important custom field that must be autopopulated is our "membername" field.
4. Fields that Sales Managers input cc information (it is not necessary to store the cc)
5. The task is assigned to me with email notification to process cc.

I hope this makes sense. I am looking to see if someone could help me with the syntax on this one or maybe someone has written something similiar that I can customize.

Thank you in advance for your help on this. Go Sales Force!

Matt