• EPSWDEV
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 18
    Replies

I have Standalone Apex class that sends out and email and in which i wish to embed a link to custom object detail page. eg link would be http://na6.salesforce.com/somecustomobj.Id

 

my problem is I dont want to hard code the domain name in the url in my apex class so am trying to find out what class I can use to get my orgs url.  I tried touse the Site.getCurrentSiteUrl however no luck with that.  I use PageReference here either - apexpages.currentPage returns null so that no good either. Any help is appreciated.

 

Thanks

Message Edited by EPSWDEV on 01-30-2009 12:06 PM

Hi I'd appreciate it if anybody can shed any light on this problem.  I am trying to send a email from a Apex class using a template. See code below.

 

 

APEX CLASS--------------------- global someapexclass { someCustomObject cust = [Select name,attr1, attr2 from someCustomObject] for(User usr : [Select u.Id, u.email, u.name From User u where u.profile.Name = 'System Administrator']){ Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setTargetObjectId(usr.Id); EmailTemplate et = [SELECT id from emailtemplate where name='MyEmailTemp']; mail.setTemplateId(et.Id); mail.setSaveAsActivity(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); } EMAIL TEMPLATE--------------------------- Dear {!usr.name} This is a test email. . Thanks.

 

 The problem is the email is sent where the {!usr.name} not substitued at runtime hence the email just says 'Dear' instead of 'Dear <the user name>'

My question is Can I reference cust and usr (variables in the apex class) in a email template  ? is this even possible ? if so what am i doing wrong. If not - then is my only alternative to set the email body at runtime inthe class and not use the template.

 

thanks

 

I wanted to know if I can use relationship queries to fetch data linked using lookup relationships ? I examples givein the doc talk about parent-child relationships but not of lookups.

 

Thanks

Hi,

I have a APEX Class whose one method I have exposed as a webservice and I am trying to call it using Java. What are the general steps I need to do in order to call this service successfully. I have seen various examples on the wiki where a java client would can access and perfrom operations on various salesforce objects using the Web Service API, However none of them show how to call a apex class exposed as a webserivce and pass data to it and recieve a response. (my Data operations are done in the method exposed as the webservice). Looking for the phptoolkit equivalent  for java.

Thanks,
I am wondering why  for every VF page created, profiles that can access it need to be explicitly set ? if I have a VF page that overrides the edit button of an object, shouldnt the system as runtime be apply the same permission  and the user would have for the object (whose edit override -> VF is in question) ? whats the advantage  of specifying the obvious ? looking for some light on this matter.

Thanks
I am trying to capture the 'onunload' javascript event on a visual force page. Adding a html body tag and then adding the onunload event dosnt work. How can I capture this event.

In general I am trying to prompt the user when they move away from this page (either to another tab or link within the browser or if they decide to close the browser).

Thanks
I am trying to capture the 'onunload' javascript event on a visual force page. Adding a html body tag and then adding the onunload event dosnt work. How can I capture this event.

In general I am trying to prompt the user when they move away from this page (either to another tab or link within the browser or if they decide to close the browser).

Thanks
I know I can construct a page reference to a objects detail page. however how do I construct the page reference to a previous page. Essentially I am trying to implement a cancel button that when its clicked, the custom controller would pass a page reference to the previous page. if I use the standard cancel functionality (not implement cancel method in the custom controller) it gives me an error to fill out one of the required fields on the page.

Thanks

PS: I know I can just use javascript --> history.back() but want to know if there is a way to do this by page reference, plus not sure is history.back() brings a cached page.




Message Edited by EPSWDEV on 01-09-2009 08:57 AM
I am planning on overriding a CustObj1's delete button such that I can  delete the custObj record in question and I can also delete some other object records with no explicit link or relationship to this record.  I came across a post which floated the idea of creating a webservice that does the delete  and bind the delete button to that webservice. and the reason to use webservice is that is runs in system mode hence users permissions for that object does not matter and we can still delete the object record(s) regardless of who created it, which makes a lot of sense. Now this was a old post and I am new so I am wondering if , I were to override the delete button with a vs page that has and extension controller that deletes the different object records  will it do it only if the user has permission for all the records?

Thanks,
I have a controller extension for a custom object edit page, and what I am trying to do is update a different custom object as part of the save functionality.

Code:
CustomObj co = [Select Id,field1,field2,field3 from CustomObj where Id =:<id string>];
co.field1 = 'someval';
co.field2 = 'someval2';
Database.update(co);


 
However I get the following error when I execute the code:
Update failed. First exception on row 0 with id a0B80000002JH1yEEF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, <field1_label> already exists. Please choose another: [<field1_name>]

strings in <> are substituted to origianl values. and there is no validation whatsoever on this custom obj and its fields.  Can please somebody explain whats wrong here ?

Thanks

I have a visual force page (call it VS1) with a custom controller(CS1). In VS1 I have a IFrame that opens a VS page (VSsub1). VSsub1 displays inputfields tied to a custom object.

Now My VS1 page has 1 button on it called save and upon clicking it I want to save my data (using the CS1). Problem is how do reference the custom object in the iframe in my CS1. Is it even possible.

If you are wondering why i am doing this - so keep a long story short I this VS1 page is used to generate page that on runtime changes the objects it displays. its part of a wizard and its the object type is selected on the previous page. and Yes I know record type does something similar however in our case we cant use it.

Thanks.
I have a visual force page (call it VS1) with a custom controller(CS1). In VS1 I have a IFrame that opens a VS page (VSsub1). VSsub1 displays inputfields tied to a custom object.

Now My VS1 page has 1 button on it called save and upon clicking it I want to save my data (using the CS1). Problem is how do reference the custom object in the iframe in my CS1. Is it even possible.

If you are wondering why i am doing this - so keep a long story short I this VS1 page is used to generate page that on runtime changes the objects it displays. its part of a wizard and its the object type is selected on the previous page. and Yes I know record type does something similar however in our case we cant use it.

Thanks.
Hi, I am trying to create a Visual source page which as two sections - Sec1 and Sec2. Sec1 display's the detail of lets say CustomObj1.
CustomObj1.field1 is a picklist  of different custom objects and depending on the value chosen, I want  the second section to display details of custom object chosen. for eg is Accounts was chosen display account detail feilds, if contact then contact detail.

whats the best way to do this?

I am implementing a component for sec2 that takes in the custom object type selected then dispaying the detail for that object however i find that I cannot specify object to a <apex:detail> tag. what are my options here.

thanks,
Hi, I am trying to create a Visual source page which as two sections - Sec1 and Sec2. Sec1 display's the detail of lets say CustomObj1.
CustomObj1.field1 is a picklist  of different custom objects and depending on the value chosen, I want  the second section to display details of custom object chosen. for eg is Accounts was chosen display account detail feilds, if contact then contact detail.

whats the best way to do this?

I am implementing a component for sec2 that takes in the custom object type selected then dispaying the detail for that object however i find that I cannot specify object to a <apex:detail> tag. what are my options here.

thanks,


Hi, I am trying to understand why lookup fields cannot be marked as required on a custom object ?  I have a lookupfield  that I am trying to change to as a required field - however I dont see that option.

Thanks.


Message Edited by EPSWDEV on 01-05-2009 01:08 PM
Hi I have a APEX class whose method I have exposed as a webservice. This method takes two parameters.

my websvc client uses the phptoolkit and Soapclient to send messages to the webservice, howerver when I try to sent the message the parameters (set as an associative array) are not being recieved by the webservice. I am suspecting that the header/msg body being generated by the client is somehow incorrect. I am looking to find a way to see what is being sent. and why its not being recieved. Any help on this matter is appreciated.

Thanks
Hi,

I wanted to know if there is a way to expose a Apex class method as a webservice that can be called without providing a session id. In other words can I call my webservice fromt he outside world without having the web service client 'log in to the salesforce system'.

Thanks,
Hi,

Is it possible to have a picklist whose values are dynamically populated based on some other custom objects data with using extending the controller using visual force ?

Thanks,




Message Edited by EPSWDEV on 12-23-2008 12:15 PM
Hi,

I am trying to "reskin" our force.com application such that when a user logs in the look and feel is different from the regular salesforce look and feel. Basically am trying to change borders, color, fonts etc to make the application look different.

My questions are
1) is this possible at all with salesforce's current offering ?
2) is there an existing CSS attached to my developer org application(s) that I can modify? and if so where can I find it ?
3) Can I specify my own css ? I so how would i go about doing that.

If anyone can answer these questions or point me in the correct direction, that would be very much appreciated.

Thanks,


Hi,

We have a svn repository that contains 1 custom application. We would like two developers working on this code and both having their own developmental Orgs.

Developer 1 created the application and hence it is available on his org.. How do we accomodate Developer 2 so that the source he downloaded  from SVN can be deployed to his org

Any help is appreciated.

Thanks,

Jigar

Hi I'd appreciate it if anybody can shed any light on this problem.  I am trying to send a email from a Apex class using a template. See code below.

 

 

APEX CLASS--------------------- global someapexclass { someCustomObject cust = [Select name,attr1, attr2 from someCustomObject] for(User usr : [Select u.Id, u.email, u.name From User u where u.profile.Name = 'System Administrator']){ Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setTargetObjectId(usr.Id); EmailTemplate et = [SELECT id from emailtemplate where name='MyEmailTemp']; mail.setTemplateId(et.Id); mail.setSaveAsActivity(false); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); } EMAIL TEMPLATE--------------------------- Dear {!usr.name} This is a test email. . Thanks.

 

 The problem is the email is sent where the {!usr.name} not substitued at runtime hence the email just says 'Dear' instead of 'Dear <the user name>'

My question is Can I reference cust and usr (variables in the apex class) in a email template  ? is this even possible ? if so what am i doing wrong. If not - then is my only alternative to set the email body at runtime inthe class and not use the template.

 

thanks

 

Hi,

I have a APEX Class whose one method I have exposed as a webservice and I am trying to call it using Java. What are the general steps I need to do in order to call this service successfully. I have seen various examples on the wiki where a java client would can access and perfrom operations on various salesforce objects using the Web Service API, However none of them show how to call a apex class exposed as a webserivce and pass data to it and recieve a response. (my Data operations are done in the method exposed as the webservice). Looking for the phptoolkit equivalent  for java.

Thanks,
I am trying to capture the 'onunload' javascript event on a visual force page. Adding a html body tag and then adding the onunload event dosnt work. How can I capture this event.

In general I am trying to prompt the user when they move away from this page (either to another tab or link within the browser or if they decide to close the browser).

Thanks
I am planning on overriding a CustObj1's delete button such that I can  delete the custObj record in question and I can also delete some other object records with no explicit link or relationship to this record.  I came across a post which floated the idea of creating a webservice that does the delete  and bind the delete button to that webservice. and the reason to use webservice is that is runs in system mode hence users permissions for that object does not matter and we can still delete the object record(s) regardless of who created it, which makes a lot of sense. Now this was a old post and I am new so I am wondering if , I were to override the delete button with a vs page that has and extension controller that deletes the different object records  will it do it only if the user has permission for all the records?

Thanks,
I am trying to create a trigger and class using Apex that will take data from a couple fields on the user record and copy them into fields on an Opportunity using the Opportunity Owner lookup field.  From within the opportunity I need to lookup the opportunity owner's user record and pull over the Title, Department, and Email from the user record and put it in the opportunity record.  I appreciate the help.
I have a controller extension for a custom object edit page, and what I am trying to do is update a different custom object as part of the save functionality.

Code:
CustomObj co = [Select Id,field1,field2,field3 from CustomObj where Id =:<id string>];
co.field1 = 'someval';
co.field2 = 'someval2';
Database.update(co);


 
However I get the following error when I execute the code:
Update failed. First exception on row 0 with id a0B80000002JH1yEEF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, <field1_label> already exists. Please choose another: [<field1_name>]

strings in <> are substituted to origianl values. and there is no validation whatsoever on this custom obj and its fields.  Can please somebody explain whats wrong here ?

Thanks

I have a visual force page (call it VS1) with a custom controller(CS1). In VS1 I have a IFrame that opens a VS page (VSsub1). VSsub1 displays inputfields tied to a custom object.

Now My VS1 page has 1 button on it called save and upon clicking it I want to save my data (using the CS1). Problem is how do reference the custom object in the iframe in my CS1. Is it even possible.

If you are wondering why i am doing this - so keep a long story short I this VS1 page is used to generate page that on runtime changes the objects it displays. its part of a wizard and its the object type is selected on the previous page. and Yes I know record type does something similar however in our case we cant use it.

Thanks.
Hi, I am trying to create a Visual source page which as two sections - Sec1 and Sec2. Sec1 display's the detail of lets say CustomObj1.
CustomObj1.field1 is a picklist  of different custom objects and depending on the value chosen, I want  the second section to display details of custom object chosen. for eg is Accounts was chosen display account detail feilds, if contact then contact detail.

whats the best way to do this?

I am implementing a component for sec2 that takes in the custom object type selected then dispaying the detail for that object however i find that I cannot specify object to a <apex:detail> tag. what are my options here.

thanks,


Hi there.

We are about to create a whole heap of custom report types.

When creating the new Custom Report Type, you must allocate it to a category from a drop-down list.

Is it possible to add categories to this list? If so, how might I go about it?

Thanks... am a bit of a n00b here.

Kind regards

Roz
  • January 06, 2009
  • Like
  • 0
Hi, I am trying to understand why lookup fields cannot be marked as required on a custom object ?  I have a lookupfield  that I am trying to change to as a required field - however I dont see that option.

Thanks.


Message Edited by EPSWDEV on 01-05-2009 01:08 PM
Hi,

I have a custom object which in turn has an Account field containing the account name.

I need to attach field from my custom object on an email template when comment is created to a case.

Here is what I have so far, but not functional:

Case: {!Case.CaseNumber}
Case Subject: {!Case.Subject}

New Case Comment:
{!Case.Last_Case_Comment}

For more information on this case, please visit the customer portal.
 
Customer Code: {!Account.Customer_Portal_Code__c}


Example Field to be displayed on email template: customObjec,field for this account name that is the owner of the case.

I hope I didn't make it confusing.

Thank you.


  • January 05, 2009
  • Like
  • 0
Hi,

I wanted to know if there is a way to expose a Apex class method as a webservice that can be called without providing a session id. In other words can I call my webservice fromt he outside world without having the web service client 'log in to the salesforce system'.

Thanks,
Hi,

I am trying to "reskin" our force.com application such that when a user logs in the look and feel is different from the regular salesforce look and feel. Basically am trying to change borders, color, fonts etc to make the application look different.

My questions are
1) is this possible at all with salesforce's current offering ?
2) is there an existing CSS attached to my developer org application(s) that I can modify? and if so where can I find it ?
3) Can I specify my own css ? I so how would i go about doing that.

If anyone can answer these questions or point me in the correct direction, that would be very much appreciated.

Thanks,