• Christian Szandor Knapp
  • NEWBIE
  • 5 Points
  • Member since 2014
  • Salesforce Developer
  • www.shore.com


  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 6
    Questions
  • 12
    Replies
Hey all,

I am experiencing an issue with aura attributes of the type date.

So we got a comoponent with an aura attribute
<aura:attribute name="dateToday" type="Date"/>

We got a Apex Controller with a  method like this one
@auraEnabled
public static insertDate(Date myDate){

//some code that sets the date on sObject.datefield

insert sOBject;

}

Mind you:
the js controller sends myDate to the Apex Controller (set etc)
The Apex Controller requires Date type as parameter
The Apex Controller accepts myDate as Type Date for the method
But DML fails: incorrect format, the myDate in ApexController misses the time part the dml statement seems to require (2015-11-05 00:00:00 instead of 2015-11-05 only)

is this per chance a known issue?

Kind Regards,
Sz
Hey there, 

I created a bunch of methods that retrieve picklist values and labels based on current users locale and use them as input select options in my component. The approach uses input from the client side controller to get the apex controller do the lifting.

Basically, I want to be able to use this functionality on a levels of a given application or salesforce1 component. 
  • component1 // define picklistretrieve function
    • sub_component1
      • child1 // use picklistretrieve function to populate specfic picklists on this level 
    • sub_component2 
      • child1 // use picklistretrieve function to populate specfic picklists on this level 
Where / How would I need to define this function ? How would I go about calling this function then in child1?

Cheers,
 
I am using a visualforce page email template in which Recipient is a Contact, relatedTo is an Event, it dynamically generates an *.ical Attachment. That works just fine by using

<apex:outputText value="{0,date,yyyyMMdd'T'HHmmss}"><apex:param value="{!relatedTo.StartDateTime}" /></apex:outputText>

What I am not able to achieve is to render a link to Google Calendar that needs the same formatting of StartDateTime/EndDateTime.

I've tried using outputtext as well, but SF prevents me of using that in < a href=''>, if I dont use < a href=''>, some clients wont render the Link as Link, i.e. it is not clickable which is not acceptable. For other reasons, I need to used < messaging:HtmlEmailBody > and cannot use PlainText.

So I tried dissecting my link into params and use Apex:Outputlink.

My approach is as follows:

<apex:OutputLink value="https://www.google.com/calendar/render">
Click me
<apex:param name="action" value="TEMPLATE"/>
<apex:param name="text" value="someValue"/>
<apex:param name="dates" value="{relatedTo.Startdatetime}Z/{!relatedTo.EndDateTime)}Z"/>
<apex:param name="details" value="someOtherValue"/>
<apex:param name="sf" value="true"/>
<apex:param name="output" value="xml"/>
</apex:OutputLink>



Is there any way to get that relatedTo.Startdatetime into the format yyyyMMdd followed by HHmmss in an apex param?

If not, can you think of any workarounds that work with the event object? (FYI: SF does not allow to use StartDateTime in a formula expression to create costums fields of the format needed)
Hey there,

still a beginner: I built an VF Email Template that has a Contact as Recipient and an Event as RelatedTo - the template is functional and generates an ics file dynamically.

Actually, I would like to use it like the other templates, without having to write (and test) a custom controller.

My initial attempt was to use something like
XY.salesforce.com/email/author/emailauthor.jsp?p2_lkid=[CONTACT_ID]&p3_lkid=[EVENT_ID]&template_id=00Xb0000000IReQ&new_template=true

but that throws an error as Salesforce does not allow for an Event to be the p3_lkid/WhatId (Opportuinities, Cases, etc are ok, though)...

I have googled quite a lot but found no solution so far, everyone seems conftonted with the same problem. Please tell me there is a workaround... :-)

Combining Templates

Hello community, another newbie question. 

This is how far i got (the picture is almost up to date ;)):

- get a list from available templates from a certain directory
- add each selected template into editable textarea
- use the edited textarea as Email Body
- send the Email

What is obviously missing is the merging of the fields in the Email body. 

I had a look on the SingleEmailMessage(); Documentation (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_sendemail.htm#SingleEmailMessage 
and also on this post https://developer.salesforce.com/forums/ForumsMain?id=906F000000094ClIAI)

It seems to me that things are getting very, very tricky at this point, if its even possible at all: As I understood in order to merge the fields approriately, I need the templateId, whatId and TargetObjectId. 

I got no problem with TargetObjectId. For WhatId it seems to be the case that might differ for each selected EmailTemplate, but if the merging of fields is really depenent on templateId, too - I can not think of any way to elegantly achieve the parsing of the templates - as I cannot provide the sendEmail method with different templateIds.

As my employer wants to be able to combine and edit templates on the fly (see screenshot), I was wondering if there is any way to achieve correct field merging without doing RegEx and stuff myself... 

If there is no other way, please point me in the right direction - I am at loss. 

Thank you for your input,

Sz

 

Dear all,

as many, I've just started coding for Visualforce. I have achieved to get a Lookup Field in my CUSTOM CONTROLLER where I can select a Contact. by digging deep into the web.

The only value I have been able to pull from that field is ReportsToId - which is - Ive looked it up - somekind of data object. The value I get in return is a string (e.g. 0031100000FAWcUAAX), though - which I cannot use to query for the Contact's Email Address (which will then be used for some Template Modification and Sending out those modified templates). 

Maybe there is a way to convert that string back into something that can be used to do the SOQL Query. 

One last thing: The Lookup field is mandatory. Obviously there are other possibilities, but it is a requirement.

Here is my custom controller:

[code]
public class Teszt2 {

// creating dummy apex property
public Contact con {get;set;}


// creating dummy method
   public String getcon() {
        return null;
    }
public String contactEmail {get; set;}  

public List<Contact> contactDetails {get; set;}
//List<Contact> contactDetails = new List<Contact>();
   
public pagereference searchdata()
{
//you can fetch dummy lookup field vale here and process accordingly.
System.debug('@@@@@@@@@@@'+con.ReportsToId);
contactDetails = [SELECT Name, Firstname, Email FROM Contact WHERE ReportsToId=:con.ReportsToId AND AccountId = :ApexPages.currentPage().getParameters().get('id')];
contactEmail = con.ReportsToId; //contactDetails[0].Email;
return null;
}

public Teszt2()
  {
// instantiate your dummy object
    con = new Contact();
  }


}

[/code]

And heres the page:


[code]
<apex:page controller="Teszt2">
<apex:form >
<apex:inputField value="{!con.ReportsToId}" label="CustomerTo" id="CustomerTo" required="true"/>
<apex:commandButton action="{!searchdata}" rerender="EmailBody" id="search" value="search"/>
</apex:form>
Boooya
<b>Emailbody: </b><apex:outputText value="{!contactEmail}" id="EmailBody"></apex:outputText>
</apex:page>
[/code]

Thank you!

Hey there,

still a beginner: I built an VF Email Template that has a Contact as Recipient and an Event as RelatedTo - the template is functional and generates an ics file dynamically.

Actually, I would like to use it like the other templates, without having to write (and test) a custom controller.

My initial attempt was to use something like
XY.salesforce.com/email/author/emailauthor.jsp?p2_lkid=[CONTACT_ID]&p3_lkid=[EVENT_ID]&template_id=00Xb0000000IReQ&new_template=true

but that throws an error as Salesforce does not allow for an Event to be the p3_lkid/WhatId (Opportuinities, Cases, etc are ok, though)...

I have googled quite a lot but found no solution so far, everyone seems conftonted with the same problem. Please tell me there is a workaround... :-)
We have a ligthning community created using Community Builder. We are trying to mask the URL (https://unfriendlyUrl.force.com/path) with our own corporate URL (https://commsite.harms123.com). I have been following this salesforce help documentation, as well as various posts on the dev forum and Salesforce Stack Exchange. Here is the official SFDC documentation:
https://help.salesforce.com/HTViewHelpDoc?id=siteforce_domains.htm&language=en_US (https://help.salesforce.com/HTViewHelpDoc?id=siteforce_domains.htm&language=en_US)

So far this is what we've done:
  1. We created a CNAME subdomain on our corporate website, lets call it community.corpsite.com.
  2. We pointed that CNAME to community.corpsite.com.OUR-18-DIGIT-ORGID.live.siteforce.com as instructed in the guide
  3. We went to Site Configuration | Domains in Set​up and created community.corpsite.com as a domain.
  4. We went to Site.com Studio, Site Configuration | Domains and made sure that the custom domain (community.corpsite.com) was listed.
  5. We published the site through both Site.com Studio AND Community Builder

When I go to my browser and go to community.corpsite.com, it redirects me to https://unfriendlyUrl.force.com/path, but doesn't mask the URL. This results in our customers having a poor branding experience, since we ask them to go to community.corpsite.com but they are being redirected to the force.com URL.

What am I doing wrong? From what I read online in their documentation, they seem to indicate that this is possible, but I can't get it to work. Is this possible? Where do I start, what is my best place for documentation on this? Could use some help, been struggling with this all day.

Thanks for your time
I'm working for these instructions -- https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm

I'm trying to get this to work.  My SB in on Winter '16.  I'm getting a 404 on my aura component (I have firebug on my browser) in the firebug console.

This is KKTestApp1.app --
<aura:application access="GLOBAL" extends="ltng:outApp"> 
  <aura:dependency resource="ui:button"/>
</aura:application>
This is KKTestLightningContainer.vfp --
<apex:page>
    <apex:includeLightning />
     This is a test.
    <div id="lightning" />

    <script>
        $Lightning.use("hmhco:KKTestApp1", function() {
          $Lightning.createComponent("ui:button",
          { label : "Press Me!" },
          "lightning",
          function(cmp) {
            // do some stuff
          });
        });
    </script>
</apex:page>


I tried including our domain "hmhco:KKTestApp1", leaving it out "KKTestApp1", and just "c" as in the example "c:KKTestApp1".

I'm my firebug console, I get 404 error on the URL --
 https://hmhco--sb2.cs42.my.salesforce.com/hmhco/KKTestApp1.app?aura.format=JSON&aura.formatAdapter=LIGHTNING_OUT
or --
https://hmhco--sb2.cs42.my.salesforce.com/c/KKTestApp1.app?aura.format=JSON&aura.formatAdapter=LIGHTNING_OUT"
or --
https://hmhco--sb2.cs42.my.salesforce.com/KKTestApp1/undefined.app?aura.format=JSON&aura.formatAdapter=LIGHTNING_OUT"


Maybe I need a different prefix.

Maybe there is some global setting to turn something on and make it available.

I'm working for these instructions -- https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm

There's no additional info on anything that has to be done.
Hey all,

I am experiencing an issue with aura attributes of the type date.

So we got a comoponent with an aura attribute
<aura:attribute name="dateToday" type="Date"/>

We got a Apex Controller with a  method like this one
@auraEnabled
public static insertDate(Date myDate){

//some code that sets the date on sObject.datefield

insert sOBject;

}

Mind you:
the js controller sends myDate to the Apex Controller (set etc)
The Apex Controller requires Date type as parameter
The Apex Controller accepts myDate as Type Date for the method
But DML fails: incorrect format, the myDate in ApexController misses the time part the dml statement seems to require (2015-11-05 00:00:00 instead of 2015-11-05 only)

is this per chance a known issue?

Kind Regards,
Sz
I've started dabling in Lightning Components and worked through a tutorial last year and have done one of the trailheads a few days.  So I know how to code basic Lightning components and apps.  And I see in the metadata that these become AuraDefinitionBundles.  I also so an example of some code where a bit of JS is added to an empty VF page and that always a Lightning Component to be spun up inside a VF page.

What I want to do is take an exist VF page that is exposed to the internet as a SF "Sites" application and port it to Lightning.  What I included in the prior paragaph leads me to believe the page is codable.  Here's what I don't know.  When a Sites application is configured, you have to tell it what it has access to-- VF pages, Apex controllers, objects and fields, etc.  I don't know how you would give it access to the Aura bundle.  (Unless it's totally implicit and you don't have to and it automatically gets acces.)

Can anyone address the question of how to configure and deploy Sites application that includes a VF page that spins up an Lightning Component?
 

Combining Templates

Hello community, another newbie question. 

This is how far i got (the picture is almost up to date ;)):

- get a list from available templates from a certain directory
- add each selected template into editable textarea
- use the edited textarea as Email Body
- send the Email

What is obviously missing is the merging of the fields in the Email body. 

I had a look on the SingleEmailMessage(); Documentation (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_sendemail.htm#SingleEmailMessage 
and also on this post https://developer.salesforce.com/forums/ForumsMain?id=906F000000094ClIAI)

It seems to me that things are getting very, very tricky at this point, if its even possible at all: As I understood in order to merge the fields approriately, I need the templateId, whatId and TargetObjectId. 

I got no problem with TargetObjectId. For WhatId it seems to be the case that might differ for each selected EmailTemplate, but if the merging of fields is really depenent on templateId, too - I can not think of any way to elegantly achieve the parsing of the templates - as I cannot provide the sendEmail method with different templateIds.

As my employer wants to be able to combine and edit templates on the fly (see screenshot), I was wondering if there is any way to achieve correct field merging without doing RegEx and stuff myself... 

If there is no other way, please point me in the right direction - I am at loss. 

Thank you for your input,

Sz

 

Dear all,

as many, I've just started coding for Visualforce. I have achieved to get a Lookup Field in my CUSTOM CONTROLLER where I can select a Contact. by digging deep into the web.

The only value I have been able to pull from that field is ReportsToId - which is - Ive looked it up - somekind of data object. The value I get in return is a string (e.g. 0031100000FAWcUAAX), though - which I cannot use to query for the Contact's Email Address (which will then be used for some Template Modification and Sending out those modified templates). 

Maybe there is a way to convert that string back into something that can be used to do the SOQL Query. 

One last thing: The Lookup field is mandatory. Obviously there are other possibilities, but it is a requirement.

Here is my custom controller:

[code]
public class Teszt2 {

// creating dummy apex property
public Contact con {get;set;}


// creating dummy method
   public String getcon() {
        return null;
    }
public String contactEmail {get; set;}  

public List<Contact> contactDetails {get; set;}
//List<Contact> contactDetails = new List<Contact>();
   
public pagereference searchdata()
{
//you can fetch dummy lookup field vale here and process accordingly.
System.debug('@@@@@@@@@@@'+con.ReportsToId);
contactDetails = [SELECT Name, Firstname, Email FROM Contact WHERE ReportsToId=:con.ReportsToId AND AccountId = :ApexPages.currentPage().getParameters().get('id')];
contactEmail = con.ReportsToId; //contactDetails[0].Email;
return null;
}

public Teszt2()
  {
// instantiate your dummy object
    con = new Contact();
  }


}

[/code]

And heres the page:


[code]
<apex:page controller="Teszt2">
<apex:form >
<apex:inputField value="{!con.ReportsToId}" label="CustomerTo" id="CustomerTo" required="true"/>
<apex:commandButton action="{!searchdata}" rerender="EmailBody" id="search" value="search"/>
</apex:form>
Boooya
<b>Emailbody: </b><apex:outputText value="{!contactEmail}" id="EmailBody"></apex:outputText>
</apex:page>
[/code]

Thank you!

I've started dabling in Lightning Components and worked through a tutorial last year and have done one of the trailheads a few days.  So I know how to code basic Lightning components and apps.  And I see in the metadata that these become AuraDefinitionBundles.  I also so an example of some code where a bit of JS is added to an empty VF page and that always a Lightning Component to be spun up inside a VF page.

What I want to do is take an exist VF page that is exposed to the internet as a SF "Sites" application and port it to Lightning.  What I included in the prior paragaph leads me to believe the page is codable.  Here's what I don't know.  When a Sites application is configured, you have to tell it what it has access to-- VF pages, Apex controllers, objects and fields, etc.  I don't know how you would give it access to the Aura bundle.  (Unless it's totally implicit and you don't have to and it automatically gets acces.)

Can anyone address the question of how to configure and deploy Sites application that includes a VF page that spins up an Lightning Component?