• narsavagep
  • NEWBIE
  • 170 Points
  • Member since 2008
  • Technical Consultant
  • D&B

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 8
    Questions
  • 46
    Replies
I have two multiselect picklist for area of interest, one is being updated from outside of salesforce which I call my area_of_interest_landing__c field, the other is area_of_interest__c. 

The area_of_interest_landing__c field may or may not have all the value selected that the area_of_interest__c field has.  I need to keep a complete set of values being selected over time in the area_of_interest__c field.  My thought was to create a trigger that would update the area_of_interest__c field whenever the area_of_interest_landing__c field is updated.  This is my first trigger and I haven't seen any examples of updating multiselect picklist so I'm kind of struggling here so I would like to know if I'm on the right track with the code below.  Currently, I get a complie error on invalid type of "String".

trigger area_of_interest on Lead (after insert, after update){
    Set<String> interests = new Set<String>();
   
    for (area_of_interest_landing__c aoiLanding : trigger.new)
        interests.add(aoiLanding.area_of_interest_landing__c);
   
    for (area_of_interest__c aoi : trigger.new)
        interests.add(aoi.area_of_interest__c);

    for (area_of_interest__c aoi : trigger.new)
        aoi.area_of_interest__c = entries.get(aoi.area_of_interest__c);
}

I need to create a link to an object within a data-table listing.
For example, list of contacts on a data table, when the user clicks the "name", it opens that Contact record view.
This seems simple enough, and yet, I'm having trouble finding a solution or example anywhere out on the internet or trailhead.  It seems like all the solutions I find are using "tiles" and cascading events.  I don't need anything that complicated.
I can post example/more information below... but would love it if someone could explain how to do this (using NavigationMixin)

Is it possible, in visualforce, to get the label of the current page, instead of the system name?

For example, something like {!$CurrentPage.Label} instead of {!$CurrentPage.Name}

The Page "Label" has spaces in it, the "Name" has underscores... I'd rather show the label to the user rather than the API Name.

I have a VF page which lists several objects at once and allows the user to update them and hit a "save" button.  When the user edits one of the fields, I want a javascript call to populate something in another field.  How do I reference the appropriate field in the action command?

 

Below is the example of what I'm looking to do.

 

<apex:pageBlockSection title="New Case Dates" columns="1" collapsible="false" showHeader="true">
    <apex:pageBlockTable value="{!CasesToCreate}" var="case">
        <apex:column headerValue="Commit">
            <apex:inputField value="{!case.Commit_Date__c}" onchange="UpdateReleaseText(this.value, ReleaseTextId?);"/>
        </apex:column>
        <apex:column headerValue="Release">
            <apex:inputField value="{!case.Release__c}" id="ReleaseText"/>
        </apex:column>
    </apex:pageBlockTable>
</apex:pageBlockSection>

 

 

 

Thanks!

Paul

I have the following code:  (Note, it is part of a future-call method)

 

 

...
String EmailFailure = null;
	
try {
	Messaging.SendEmailResult[] mailResult = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
	if ( !mailResult[0].isSuccess() ) {
		EmailFailure = 'Email Failed: ' + mailResult[0].getErrors()[0].getMessage();
	}
}
catch(DmlException dmlEx) {
	EmailFailure = 'Email Failed: ' + dmlEx;
}
	
if ( EmailFailure != null ) {
...

 

 

It is failing with the following error whenever an attempt is made to send to a contact with an invalid (bounced) email address.

 

Failed to invoke future method 'public static void SendSurvey(String, Id, Id, Id, Id, Id, String, String)' on class 'Survey_Controller' for job id '70730000003xhE1'

caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 0033000000VqJyN: []

 

 

How can I capture the error gracefully instead of getting this error message?  I thought if I wrapped it with try/catch it would work.

 

Thanks,
Paul

Is there a way for the code to know whether or not it is running in a production instance, or a sandbox?

 

I have scheduled APEX that sends an email to specific email addresses three times a day.  Whenever someone makes a new sandbox in our company, that sandbox starts sending the emails and I have to manually go into every sandbox when it is created and remove the scheduled APEX.  I want the function to be smart enough to know that it is running with a sandbox environment, and therefore not send the email.

 

Any ideas?  

 

Thanks!

Paul

How do I embed a VF component (or page) into a "Close Case" page layout?  

Is it possible?

 

I want to create a formula field to show the Case Owner Full Name on a child object.

There's no way to do this??

The only thing available is "OwnerId"...

I can do "CreatedBy.LastName" and get the name of the Creator... why can't I do the same thing to get the Owner's last name?

Am I missing something?  Is there a way to do this?

 

I have Apex script as part of an Opportunity trigger that creates a Case and assigns that Case to a queue.
 
How do I send the queue members an email that the case has been assigned to them?
(I want to mimic the send email functionality that exists in the "Case Assignment Rules", which sends an email when a case is routed to a queue.)
 
Currently I am manually assigning the case to a queue within my Apex trigger.
If the solution would be to create the case and then "fire-off" the auto routing rules, I would be happy to do that, but then my question is "how do I do that?"  :)
 
Thanks,
Paul

Hi everyone,

I'm doing a rest call to retrieve attachments out of Salesforce. The first call would get the information of the attachment which has the URL to the body of the attachment. From there, I take the URL of the body and do another call to retrieve the contents of the attachment.

The calls are successful, however, when getting a response back, the response.getBody() return a string that does not translate to anything. When saving to a file or reuploading or encoding it, it always ends up to be gibberish or a broken file.

 

My questions are:

 what kind of content does the GET method return for the URL: https://SOME_ORG.salesforce.com/services/data/v20.0/sobjects/Attachment/SOME_ID/body

Am I missing anything to get the correct format? The headers that are being included in the final call for my attachment body are Content-Type, Authoriatization, and Accept

 

I also forgot to mention that postman is able to retrieve and display the content just fine. The issue is that the rest call returns a binary string and I am unable to translate it back to the actual content itself.

I need to create a link to an object within a data-table listing.
For example, list of contacts on a data table, when the user clicks the "name", it opens that Contact record view.
This seems simple enough, and yet, I'm having trouble finding a solution or example anywhere out on the internet or trailhead.  It seems like all the solutions I find are using "tiles" and cascading events.  I don't need anything that complicated.
I can post example/more information below... but would love it if someone could explain how to do this (using NavigationMixin)

I have written a code to attach multiple attachment from vf page using forcetk.
The code is working fine when I am running the VF page individually
but when I am attaching the VF page in Salesforce Site the file is not attaching and its giving INVALID_SESSION_ID.

Is there any way to get SessionID in Salesfore Site.
Can anyone help..??
Is there any limitation that dependent picklist value is not being populated using defaultValues in force:createRecord?
createINTRecord:
function(component, event, helper) { 
var iws = component.get("v.parentIWS"); 
console.log('IWS details Specialty__c: '+ iws.Specialty__c); 
var createRecordEvent = $A.get("e.force:createRecord"); 
createRecordEvent.setParams({ 
"entityApiName": 'Apprenticeship__c', 
"recordTypeId": null, 
'defaultFieldValues': { 
'Opportunity__c': iws.Opportunity__c, 
'InternshipWorkSite__c': iws.Id, 
'Track__c': iws.TrackFamily__c, // Controlling Field 
'Job_Category__c': iws.Specialty__c, // Dependent Field 
'Employer__c' : iws.Account__c, 
'Cohort_Sem__c' : iws.Opportunity__r.Cohort_Sem__c, 
'Start_Date__c' : iws.InternshipStartDate__c, 
'Site_Location__c' : iws.Site_Located__c, 
'Internship_Cluster__c': '--None--' } 
}); 
createRecordEvent.fire(); }


Issue:
'Track__c'-----> // Controlling Field
       'Job_Category__c'---> // Dependent Field of Track__c
                'Internship_Cluster__c'---> //Dependent Field of Job_Category__c

I am able to assign the value to only top level picklist, but not dependent fields. I can see the value printing in the console and also value available in the picklist. However the value is not populated in the form.

User-added image
  • March 21, 2018
  • Like
  • 0

1down votefavoriteI am trying to auto populated the force:inputfield but its not working, is there some specific way to populating as other types of field are working fine like picklist, text, date & checkbox

Here is the code
Component
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="recordId" type="Id"/>
<aura:attribute name="account" type="Account" default="{ 'sobjectType': 'Account' }"/>
<!-- lookup to lead on account object -->
<force:inputField aura:id="accNe2" value="{!v.account.Lead__c}"/>

Here is the controller
 
doInit: function(component) {

    var action = component.get("c.getAccountFieldValues");
    action.setParams({ recordId : component.get("v.recordId") });
    action.setCallback(this, function(actionResult) {
        var infos = actionResult.getReturnValue();
        component.set("v.account", infos);             
    });
    $A.enqueueAction(action);
},

And the apex method has normal SOQL returning account record.
Hi
When a case is created, we'd like it assigned to a Queue, depending on the Service Provider chosen (custom field Service_Provider__c).
This is a lookup to Account.

Step 2 in the asignment is, formula evaluates to True...
Service_Provider__r.Id  = "0010Y000005FNcxQAG"

(the ID for this service is 0010Y000005FNcxQAG)

Step 3 - I specify the Queue.

It doesn't work - what am I doing wrong please?
I am a newish admin, rather than a developer... 
 
Hi,

How i can check on controller if page is opened using 'Salesforce Classic' or 'Salesforce lightning' UI(for winter 16 release).

Thanks,
Kanwalpreet Singh

We recently went live with our Community Portal that is hosted at ourcompany.force.com. With that, we installed an SSL certificate for this portal through salesforce.com > setup > security controls > Certificate and Key Management. The only problem is that the salesforce.com portal does not have a way to install the Intermediate (Leaf) CA which is associated with our SSL cert. If we connect to our portal with Firefox or if we run a Qualys/Symantec SSL check, the browser/SSL Check throw an error about chain validation. The reason why IE doesn't show an error is that IE ships with many Intermediate CAs already embedded which is a security no-no. I've opened up many support tickets with salesforce.com but they keep on telling me this is a dev issue which I disagree. Has anyone else come across this issue since 99% of the SSL market now have Intermeidate CAs associated with their SSL certs?
 

Thanks!

I have a formula field where I create a link using HYPERLINK. I want one of the parameters in the url to be encoded. So I tried to use URLENCODE. But I get an error that URLENCODE is not allowed in a formula field.

 

My formula (field type is Formula (Text)):

 

HYPERLINK('http://foo.com?bar=' + URLENCODE(Bar__c))

 

Error:

 

Function URLENCODE may not be used in this type of formula (Related field: Formula)

 

It seems like a perfect fit to use URLENCODE to encode parameters for use in HYPERLINK. Am I missing something?

 

I can use SUBSTITUTE and do the encoding myself, but I am trying to see if there is a better way.

 

Thanks,

VV

  • July 05, 2013
  • Like
  • 0

Hey folks. I'm writing a Visualforce page that will act as a custom console component in the Service Cloud Console, and I'm seeing some odd behavior when using apex:outputLink. Net-net: the outputLink tag intelligently renders differently when in the console vs outside the console (fantastic) but for some reason, the Javascript function it calls when operating *in* the console cannot be found...even if I import the Console Integration Toolkit.

 

Here's the VF page in question:

<apex:page standardController="Case" extensions="MyExt" showHeader="false" sidebar="false">
<script src="/support/console/28.0/integration.js" type="text/javascript"></script>
 <apex:pageBlock rendered="{!initiated}" title="Users">
  <apex:pageBlockTable value="{!portalUsers}" var="user">
   <apex:column title="Username">
    <apex:outputLink value="/{!user.Id}">{!user.Username}</apex:outputLink>
   </apex:column>
   <apex:column title="Name" value="{!user.Name}"/>
  </apex:pageBlockTable>
 </apex:pageBlock>
</apex:page>

 

Even when including the console toolkit js file (using both manual <script> tags and <apex:includeScript>) I get the following error when clicking on the rendered link in the console:

Timestamp: 6/23/13 6:31:29 PM
Error: ReferenceError: srcUp is not defined
Source File: javascript&colon;srcUp('%2F005i0000000poJdAAI%3Fisdtp%3Dvw');
Line: 1

 Any thoughts on what I may be missing?

 

 

 

 

 

In my visualforce page, I have an array:

var availableTags = [
			"ActionScript",
			"AppleScript",
			"Asp",
			"BASIC",
			"C",
			"C++",
			"Clojure",
			"COBOL",
			"ColdFusion",
			"Erlang",
			"Fortran",
			"Groovy",
			"Haskell",
			"Java",
			"JavaScript",
			"Lisp",
			"Perl",
			"PHP",
			"Python",
			"Ruby",
			"Scala",
			"Scheme"
		];
		

 How can I populate this array with data from salesforce?

 

 

I read on the boards that this would work:

availableTags = "{!designations}";

 But it doesnt work. My data is not getting into the javascript array.

I tried this with the repeat tag as mentioned Here

but still no good.

 

Shouldn't this be simple?

 

 

There is an "idea" to disable jobs, but is there a way to mass delete them all using Apex?   Would like to delete the following:

 

Dashboard Refresh

Data Export

Scheduled Apex

Report Run

 

 

 

https://sites.secure.force.com/success/ideaView?id=08730000000HBnU

I have an app that does stuff with OpptyTeamMembers, but that app can't be installed in orgs that dont' have it turned on, and I don't want to have to create 2 versions of the app.

 

My solution to this is to make all the opptyTemMember references dynamic using sObjects, but I'm stuck on how to create new records as I get an error trying to do this:

sObject ot=new sObject();

 Error: Type cannot be constructed:sObject

 

I can't simply copy & update an existing opptyTeamMember as the ID fields aren't updatable.  

 

I realize the Apex guide says this isn't possible:

The new operator still requires a concrete sObject type, so all instances are specific sObjects.

 

...but an old thread on the partner API hints that it should be possible:

http://boards.developerforce.com/t5/NET-Development/getting-error-when-using-create-with-the-Partner-wsdl/m-p/27483/highlight/true

Create a formula field on the cases object called "Reference"

 

with the following formula

 

"[ ref:???????.????" & SUBSTITUTE( RIGHT(Id,11) , "0", "") & ":ref ]"

 

Replacing the ?? with the data from one of your own ref records.

The Red ?? you can copy directly from one of your own Ref records

The Blue ?? are the first 4 of the Case ID which doesn't change

 

 

Once you've created this field you can add it to workflow email templates on the subject line and it will basicly do what SF does when you email out from a case

 

You can also copy  this Reference when someone sends you an offline email and forward it to your support email with the Ref pasred in the subject line and it will attach that email to your case.

Hi all

 

I am writing test cases for my Apex Page and want to verify that different messages are set at different points.

 

For this, I would like to clear out existing messages from my ApexPage.

 

Something similar to:

 

ApexPages.Messages = new List<ApexPages.Message>();


Is there a way to do this?

 

I'm trying to copy a new user as contact by using a trigger but I'm getting the following error

 

MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User

 

trigger Acceleration_User_Copyto_Contact on User (after insert, after update) {
    
   // Map<String,User> newLead = new Map <String, User>();
    
    system.debug('Acceleration_User_Copyto_Contact Trigger....');
 
    for ( User user : System.Trigger.new)
    {
        if  (user.Email.contains('acceleration'))
        {
            system.debug('Acceleration_User_Copyto_Contact Trigger..2.');
            Integer RecordCount = [select count() from Contact c where c.Email = : user.Email];
            
            system.debug('Acceleration_User_Copyto_Contact Trigger..2a .' + RecordCount);
            
            if (RecordCount == 0)
            {
                String AccountId = '';
                for ( Account a : [Select a.Id From Account a where Name = 'Acceleration']) 
                {
                    system.debug('Acceleration_User_Copyto_Contact Trigger..3.');
                     
                    AccountId = a.Id;
                
                    Contact con = New Contact();
                    con.AccountId = AccountId ;
                    con.Email = user.Email;
                    con.Firstname = User.Firstname;
                    con.Lastname = User.Lastname ;
                    con.User__c = User.Id;
                    insert con;
                }          
            }                   
        }
        
     }
    
    
}

 

Hi, I am trying to retrieve Created By field using Query shown below

"select CreatedBy from Account where id = 'XXXXXXXXXX'"

But it's giving me the following error

INVALID_FIELD:
select CreatedBy from Account where id
       ^
ERROR at Row:1:Column:8
No such column 'CreatedBy' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.


Can you please help me in this.


           Thanks!


Raj S
  • October 14, 2008
  • Like
  • 0

Hello,

 

I am creating a visualforce page, and want to set the tabStyle attribute based on Record Type.  However, when open the visualforce page with the following (where MyTabStyle is a string like 'contact', 'account', etc).

 

 

 

 

<apex:page standardController="Opportunity" extensions="myOppExtension" tabStyle="{!MyTabStyle}">

 

 

I get an error "Error: Invalid tabStyle '{!MyTabStyle}' specified. If you are trying to reference a custom Visualforce tab, you must append '__tab'".

 

Is setting the tabStyle this way supported?

 

Thank you