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

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 8
    Questions
  • 40
    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

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,

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

Thanks,
Kanwalpreet Singh

Hi there

 

It seems to me that the "ALL ROWS" keyword that you use in SOQL (to access records in the recycled bin) can only be used in Apex.

 

I went to Developer Console in the Query Editor and tried typing this

 

SELECT ID FROM Fruit__c 

and it executes.

 

But If I add "ALL ROWS" at the end, i.e.

SELECT ID FROM Fruit__c ALL ROWS

 

then I got

"Unknown error parsing query" error.

 

If I write this in an Apex code, like this

 

List<Fruit__c> fruits = [SELECT ID FROM Fruit__c ALL ROWS];

 

then the line actually executes successfully.

 

It seems weird to me that "ALL ROWS" keyword cannot be used inside the Query Editor.  Wondering if anyone has encountered that?

 

Thanks

King

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?

 

 

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

Is it possible to view the value of individual bytes in a blob? We are trying to store a series of values within a blob and then reference them by looking at a range of bytes in that blob. Any ideas? Thanks, Barry
  • January 30, 2011
  • Like
  • 0

Hi,

 

Does any one knows, why can't assign the AssignmentRuleId (Active assignment rule) on Case object in the API interface.

 

It is possible to checked this option in salesforce UI for each Case/Lead object created, but it's NOT possible (there's NO option) in the API interface.

 

I Wish the possiblility to set the AssignmentRuleId in the API interface.

 

Sincerely

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?

 

Hi, I'm trying to perform an approval action through APEX code, in an extended controller.  

First I do a Submit for Approval, overwriting the standard one with a visualforce custom button. Here is the code in my extended controller:

 

public PageReference submitApproval() { // Create an approval request for the account Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setComments('Submitting request for approval.'); req1.setObjectId(purchaseRequisitionObj.id); // Submit the approval request for the account Approval.ProcessResult result = Approval.process(req1); return Page.PR_Detail_VF; }

After that event, the object left in "Pending" approval state. Then in my detail visualforce page, for specific cases, I have a "Direct Approval" button. That button should perform the instance approval changing its state to "Approved". Here is where I'm stuck, because I can not find the way to get the WorkitemId of the request. I mean the workitemId of the instance I asynchronously approved before. This is the code:

 

public PageReference directApproval() { // Instantiate the new ProcessWorkitemRequest object and populate it Approval.ProcessWorkitemRequest req2 = new Approval.ProcessWorkitemRequest(); req2.setComments('Direct approval by requester'); req2.setAction('Approve'); req2.setNextApproverIds(new Id[] {UserInfo.getUserId()}); req2.setWorkitemId("FROM WHERE I CAN GET THIS ID??"); // Submit the request for approval Approval.ProcessResult result2 = Approval.process(req2); return Page.PR_Detail_VF; }

 

Any cue will be highly appreciated. Many thanks in advance Fernando.-

 

  • July 14, 2009
  • Like
  • 0

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 all:

  Does anyone know how to format a number in Apex so that a number in VF appears correctly...

for example 25000 appears 25,000.00

Anyone have an idea or did this already??

Thanks

Let MMA guide you

Hi,
Does any expert know how to set the focus to a specified field in the Visualforce Page?
Best regards!
  • October 23, 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