• Serena Schultz
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 12
    Replies
Hello All!

I’m a fairly proficient declarative admin with minimal Apex writing knowledge. I tend to avoid it whenever necessary. However, I have a requirement where I need to run an automation before delete on a custom object. I have this handled from the record page (I’ve created a custom Delete button that calls a flow to evaluate if the record can in fact be deleted and the updates the user accordingly if it is not allowed via a screen pop-up). 

However, there is still a loophole where users can delete from list views or related lists since I cannot seem to figure out how to swap out that delete button.

My workaround idea is to use a Before Delete Apex trigger to launch a headless version of the same flow to evaluate and delete the record (or not). 

Below is the code for my Apex trigger. It doesn’t show any errors from the developer console, but honestly I’m not 100% sure how to test it. 

My hope is that it will run before delete to call the flow (which works well when called via debug mode) and either complete the delete or cause a failure on the delete (which I can then send notifications or email alerts from). When I’ve tested this the records just delete (even when the flow shouldn't allow them to) so I'm not sure everything is running. I’m not sure if it’s an issue with my code or with my scenario. If I run a flow before delete will it disrupt the deletion or just run before the delete happens?

Thanks in advance!

Apex code example
I have a customer community with a form embedded on a custom page. I have javascript included in the form which will autosubmit the form if the user hits the back button or the refresh button on their browser. The javascript will also timeout to the homepage after a set time delay to force the autosubmission of the form.

The goal is to autosubmit forms before a user accidentally navigates away, closes or refreshs their browser tab, or leaves the page open longer than their SF session time limit.

My code (below) is working for all scenarios EXCEPT when a user manually navigates away from the form page by clicking another tab in the navigation, etc.

I want to update it so that it will run on timeout, browser back, browser reload, browser close, AND user navigates away.

Any ideas oh wise dev community? Thanks in advance!
 
function updateRequiredFields() 

   fs('input,textarea,select').each(function(){
        if(fs(this).attr('data-isrequired')=='true' && fs(this).val()==""){ 
             fs(this).attr('data-isrequired','false');
        }
});


window.onbeforeunload = function() {
   updateRequiredFields();
   SubmitData();
console.log("data submitted");
  };

setTimeout(function(){ location.replace("https://community-pathfoundation.cs14.force.com/granteeportal/s/") }, 30000);
Hello Smart Salesforce People!

I'm hoping you can shed some light on a screen flow error I'm getting. 

Situation: I have a screen flow in a Community that allows community users to upload files to their Account record. When that file is uploaded the ContentDocID is saved in a field on the Account and any change to this field fires an autolaunched flow to go through a series of steps to create a content distribution record for the uploaded file and then post the Content Distribution Download URL to a second field on the Account record (which is then fed to an API to post the image on a public website).

These two flows are working well together in Production, but I have two sandboxes (one on Winter '19 and the other on Spring '19) where I am now getting this error on the autolaunched flow. (See below)

I've googled the error message and I'm coming up blank. Thoughts? What is this and how do I fix it?

Error element GetPublicDownloadLinkURL_1 (FlowRecordLookup).
This error occurred when the flow tried to look up records: java.lang.IllegalStateException: commits are not allowed because someone called setCommitAllowed(false), justification: null. You can look up ExceptionCode values in the SOAP API Developer Guide.

Flow Details
Flow Name: Set_Public_Link_for_Institution_Logo_Upload
Type: Autolaunched Flow
Version: 10
Status: Active

Flow Interview Details
Interview Label: Set Public Link for Institution Logo Upload 2/1/2019 4:19 PM
Current User: School Admin Test (x)
Start time: 2/1/2019 4:19 PM
Duration: 0 seconds

How the Interview Started
School Admin Test (x) started the flow interview.
Some of this flow's variables were set when the interview started.
varInstitutionId = 0011H00001R9RWbQAN
varWRGPImageContentDocID = 069J0000000g4n8IAA

DECISION: Is_Logo_DocID_variable_null
Executed this outcome: Yes
Outcome conditions: 
{!varConfirmedContentDocID} (null) Is null true

DECISION: Is_WUE_Image_DocID_variable_null
Executed this outcome: Yes_0
Outcome conditions: 
{!varWUEImageContentDocID} (null) Is null true

DECISION: Is_WRGP_Image_DocID_variable_null
Skipped this outcome because its conditions weren't met: Yes_0_0
Outcome conditions: 
{!varWRGPImageContentDocID} (069J0000000g4n8IAA) Is null true

Executed the default outcome

RECORD QUERY: Find_Uploaded_Logo_0_0
Find one ContentDocumentLink record where:
LinkedEntityId Equals {!varInstitutionId} (0011H00001R9RWbQAN)
ContentDocumentId Equals {!varWRGPImageContentDocID} (069J0000000g4n8IAA)
Result
Successfully found record.
{!varContentDocID} = 069J0000000g4n8IAA

RECORD QUERY: Content_Document_Version_0_0
Find one ContentVersion record where:
ContentDocumentId Equals {!varContentDocID} (069J0000000g4n8IAA)
IsLatest Equals true
Result
Successfully found record.
{!varContentVersionID} = 068J0000000gAeqIAE

RECORD CREATE: Create_Content_Distribution_0_0
Create one ContentDistribution record where:
ContentVersionId = {!varContentVersionID} (068J0000000gAeqIAE)
Name = {!fUploadedLogo} ( Institution Logo)
PreferencesAllowOriginalDownload = true
PreferencesAllowViewInBrowser = true
PreferencesLinkLatestVersion = true
PreferencesNotifyOnVisit = false
RelatedRecordId = {!varInstitutionId} (0011H00001R9RWbQAN)
Result
A record is ready to be created when the next Screen or Wait element is executed or when the interview finishes.
{!varContentDist} = 05DJ00000008SSJMA2

RECORD QUERY: GetPublicDownloadLinkURL_1
Find one ContentDistribution record where:
Id Equals {!varContentDist} (05DJ00000008SSJMA2)
Result
Failed to find record.
I have a NEW ORG and a SANDBOX which both have Customer Communities. The user settings, permissions, sharing sets, etc. are all the same (as far as I can tell). The only difference is that the the SANDBOX community is live, and the NEW ORG community is still in preview. In both communities I need to allow community users to submit a record for approval.

It seems like in the NEW ORG, even though I've created a “All Customer Portal Users” public group and set the Approval Process to allow all users in that group to submit, community users cannot submit unless I specifically add their user to the list of users who can submit for approval (not ideal).

Again, the approval process setup is exactly the same in the NEW ORG and in SANDBOX (where community users are able to submit), except for the fact that I've not yet set the community in the NEW ORG to active - it's still in preview.

I can't find any documentation confirming if the state of the community would make any difference in this way, but I'm really confused at why users aren't able to submit for approval unless their specifically added to the Approval Process. Anyone have ideas?
 
Hello!

I have a customer community where I'm allowing representatives of colleges/universities to update their information which will be shown via the REST API on a public searchable website.

I want to allow users to upload their institution's school logo and a campus photo to be shown on their profile page. I know that community users can upload files, but I'm not sure how to autoname them or set them up in a way that they can be easily distiguished through the API as the institution logo or the institution campus photo.

Any recommendations? 
Thanks!
Hello Smart People!

I'm hoping someone else has already solved this problem as I'm coming up short in my Google searches. Here's the situation:

I have a Customer Community set up and Sharing Sets which allow each Community User to access their own Account, Contacts under account, and a few other custom objects related to their account. Generally this works well, but I have a few instances where ONE COMMUNITY USER is going to need to have access to additional Accounts (and all of their associated records: contacts and the two custom objects). 

Is there any way to do this? I'd prefer not to have to set up multiple users for the same person (thus creating duplicate contact records) just so they can access each Account. 

I tried using Related Accounts, but that's not the same structure.

Thanks!
Hi All,

I'm very, very new to Salesforce APIs and am not a developer, but I have been tasked with helping to set up the integration between our Salesforce org and Higher Logic. HL has asked for API access via SforceService login/password. Here's what I need to provide to them:

SforceService.login Username
SforceService.login Password
Include appended token
Sforce API 24 hour call allotment

It seems like these are referencing the SOAP API and to date I've only added Connected Apps to connect to the REST API. Can anyone point me to clear documentation for how to set up these credentials? 

Thank you!
Serena
I have a client who is creating new Account records using an offline mobile app (TaroWorks). When a new account record is added via the app and it happens to meet the block criteria for one of our duplicate managment rules the mobile user received a sync error like the one in the image below (it's in Spanish because the mobile user's language is set to Spanish). 

Obviously, that error message is not helpful at all, but it's coming from a Process Builder that's trying to create the Account and Contact and is failing due to the Duplicate rule block. Ideally, I'd like to alert the mobile user in some way what the issue was. I know what the issue was because I get a flow error email with the following info:

Elemento de error myRule_1_A4 (FlowRecordUpdate).
El flujo intentó actualizar estos registros: null. Se ha producido este error: DUPLICATES_DETECTED: Este ID de Gobierno ya existe en el sistema. Por favor, introduzca un ID de Gobierno diferente.. Para obtener más detalles, consulte 


Is there a way to send a message to a user with values from the blocked record when a PB to create records fails due to a duplicatation rule?   


User-added image
I think the answer is no... but does anyone know if there is a way to initate a Process Builder or flow (or even apex) when a record is viewed vs. created/edited?

Hello! 

I'm trying to create the Einstein Vision Lightning App per this trailhead (https://trailhead.salesforce.com/projects/build-a-cat-rescue-app-that-recognizes-cat-breeds/steps/cat-recognition-app-ui-einstein-vision). I added the Apex Class and Lightning Component as shown, but when I add the component or try to use it I get this error:
User-added image

Any idea what this is or how to fix?
Thanks!

Hello!
I have a visual flow which is using an incoming SMS message logged in Salesforce to:
  • Identify if the SMS came from a Staff Contact
    • If the SMS did not come from a Staff Contact, a checkbox is set to True on the starting object record to keep the flow from refiring later. THIS WORKS
  • If it did come form a staff contact the flow then stores the message text in a Variable (vStoveID)
  • It then uses vStoveID to look for an Account record with a matching  Stove ID and a "Stage" value of Construction Complete
    • If a matching Account record is NOT found, a specific Failure SMS is sent to the Staff Contact by updating the Staff Contact record and a checkbox is set to True on the starting object record to keep the flow from refiring later. THIS WORKS
  • If a matching Account record IS found, then 3 fields on that matching Account record are updated AND a specific Success SMS is sent to the Staff Contact by updating the Staff Contact record.
    • This is where I'm running into issues. All endpoints above work great, but this endpoint fails with this error: LIMIT_EXCEEDED: System.LimitException: Mogli_SMS:Too many queueable jobs added to the queue: 2.​ I've been researching this and I can't seem to find a way to reduce the queuable jobs. 

Here's the structure of my flow currently:
User-added image

In addition, I need to connect the "Record Update: SMS Success Message" step back to the "Record Update: Flow Completed" step to really finish the flow, but I fear that would add another job and continue to muck things up.

I'd really like to keep from goigng into code on this. Any suggestions?

Thank you!

Serena

We have two custom text fields which hold unformatted phone numbers on our Contact object.  We’ve created a simple flow triggered by process builder to update other fields on the Contact if a unique code is texted in and received by our SF instance. The flow works as follows:

1)  Fast Lookup on Contact using the phone number in custom text field to match against phone number of SMS message (formatting is the same for both fields). 
2)  If matching contact is found other fields on the Contact record are edited and updated.
3) If matching contact is NOT found an email is sent to the system admin.

Here's the problem.  This works perfectly if the Fast Lookup is checking a text field on the Contact which is in a managed package and is set as an external ID.  However, if I search on an identical custom text field that is not set as an external ID, the flow fails to find the matching Contact. See error below:  

FAST LOOKUP: Find_Contact_with_Matching_Phone_Number
Find all Contact records where:
SMS_Opt_In__c Contains {!oForm.SMS__Phone_Number__c} (12223334444)
Assign those records to {!oFormMatchedContact}.
Save these field values in the variable: Id
Result
Failed to find records.
 
I have two versions of this flow that are identical except for the field that's being searched.  

Is there any reason why flow would treat a text field in a managed package that is set as an external ID differently from a custom text field?

Thank You. 
Hi All,

I've created a flow which runs when triggered by a process builder. Once the PB initiates the flow it looks to see if the triggering record is associated with a Contact and if it is, it runs through a few steps to create a chatter post and then update the record that triggered the process. That all works fine.

However, if the triggering record is not associated with a Contact, then I've set the flow to look to see if it's associated with a Lead. Although I'm using the same logic in this step, for some reason the switch from Contact to Lead is causing the flow to fail. In addition, I'm receiving the fail email from the PB saying it was the flow's error that cause the failure, but I'm not receiving any error messages from the flow. 

Any thoughts on what might be going on here? 

Below are screenshots to futher explain my process:
Full flow

User-added image
User-added image
User-added image
Hi All,

I'm trying to upgrade a JavaScript button I have in Classic to work in Lightning. In Classic this JavaScript button opens a VisualForce page in a new window with some content populated based on the Parent page that the button is housed on. To migrate this to Lightning I've created a Detail Page Button which displays in a new window and calls a VisualForce Page. 

The VF page that I'm calling opens the page I want just fine, but it is ALSO navigating me away from my parent Detail page (in this case contact). 

Any thoughts on why? Code is below.

THANKS!
 
<apex:page standardController="Contact">
   <script>
       myFunction();
           function myFunction() {
                if ({!NOT( ISNULL(Contact.MobilePhone) )}){ 
                        var url;
                        if('{!$Label.AppName__namespace}' === "none"){
                        url="/apex/" + "SendMessage?contactIDs={!Contact.Id}"+"&contact=1&modal=1"; 
                        } else { 
                        url="/apex/" + '{!$Label.AppName__namespace__namespace}' + "SendMessage?contactIDs={!Contact.Id}"+"&contact=1&modal=1"; 
                        }
                        
                        window.open(url, 'Popup','height=510,width=1200,top=0,left=0,location=no,menubar=no,titlebar=no,toolbar=no,status=no');  
                } 
                else{ 
                    alert ("Mobile Number Missing."); 
                }
            }
   </script> 
</apex:page>






 

Hi Everyone,

Recently we've integrated with an event marketing platform which will sync with Salesforce and create a Contact if someone registers for an event and they are not already a Contact in our instance of SF. This is great, except that the platform requires that we specify what Account they be mapped to which is leading to a bunch of folks being added to an Orphaned Event Registrant Account.

I've been tasked with creating an automation which will create a new Account record from the platform-created Contact record, and then reassign the Contact to the newly created Account. I'm trying to do this via a PB that initiates a Visual Workflow.

So far, I've been able to lookup all of the Contacts which are related to the Orphaned Event Registrant Account and create Accounts for them, but I cannot get the Contacts to then reassign to the new Accounts. I've tried adding Wait element. I've tried going directly to the Contact Update, but in both instances I'm getting a flow error that states that "The flow failed to access the value for CventAccount.Id because it hasn't been set or assigned." 

Theoretically I could add Wait element after the Accounts are created, but I'm not sure how to then Look Up those new Accounts.

Here's what I've got right now...
User-added image

I've read that you can reference previous Fast Creates, etc. later in your flow, and I've noticed that if I add a Wait element after creating the accounts and then add a Fast Lookup to find the Accounts again I have the option of selecting my Fast Create element within the filter... but I can't find any documentation around how to use it properly.
User-added image

Any thoughts would be most welcome - I feel like I'm missing something obvious!

Thank you!
Serena

I'm the system admin for a Community and recently I've started getting this error message by email: 

"A new user's attempt to register at NAME_Portal failed because the value for the profileID attribute is either null or invalid. Set the profileID for new users on the ChatterAnswersRegistration Visualforce page for the site associated with community NAME_Portal or on the apex class associated with the Facebook authprovider."

We don't have Chatter Answers enabled and we don't have Facebook set as an Auth Provider so I'm not sure what's going on there. Additionally, we haven't made any changes to our code recently around the self registration. Any thoughts?
Hi All,
I'm stuck. I need a field update formula to extract data from between two characters (in this case commas). 

For Example: 00442178,01,1625196411116,JOSE,OMAR,MEJIA,SANCHEZ,214,

I want to extract the value between the 3rd and 4th comma. The number of commas will be consistent but not the number of characters between them. 

I’ve been able to find the first comma using FIND(“,”, Field__c, 1), but I can’t figure out how to start at the third comma and return all values between it and the fourth comma. Help?

Serena
Hello All!

I’m hoping you can help me with an automation. Here’s the scenario:

I have a org with Advanced Currency Management enabled. I’ve used this Salesforce resolution article (https://help.salesforce.com/articleView?id=000211817&type=1) to recreate my currently rollups and formulas from Payments to Opportunity and those all work fine.

I now have a new requirement to automate the creation of payment records using values from some custom fields that we’ve added to Opportunity. I’ve been able to do this via a process builder which fires on creation of a new Opportunity with the relevant fields populated (see below).

User-added image

When the Payment record(s) are created the “Total Payments” custom rollup is also populating correctly (see below). 
User-added image

The problem is with my Balance Due field. This field is populated using a workflow which fires on creation and edit to calculate the value (Amount - Total Payments) and then populate it into a custom currency field. (This path is due to Advanced Currency Management being enabled.)

Currently, my custom Balance Due field is not updating upon the creation of the Opportunity and Payment records. It stays set to the initial Amount - Total Payments value. If I edit and save the Opportunity record then my workflow fires and the field updates.

I think this might be an order of operations issue, since both the opportunity and payment records are being created at once, but I’m not sure. 

For the moment, I've added a scheduled action to my process builder to repopulate a field on the opportunity with its previous contents to force an edit/save which would run the workflow for my Balance Due field, but I can’t schedule that to happen any sooner than 1 hour after the records are created which is not ideal.

Any thoughts on other ways to get the Balance Due workflow to fire immediately after the records are created so that it updates correctly right away?

Thanks!
Serena
Hello! 

I'm trying to create a workflow rule/field update formula to to replace first digit in phone number field with "+256". (Example: 0702475002 should be +256702475002).

I've tried the following two forumulas so far without luck - any help would be appreciated!! 

if(begins (Phone_Number__c, "0"), 
substitute(Phone_Number__c,"0", “+256"),"")


IF(BEGINS(Phone_Number__c,"0"), RIGHT(Phone_Number__c,1), “+256”)

Serena
I think the answer is no... but does anyone know if there is a way to initate a Process Builder or flow (or even apex) when a record is viewed vs. created/edited?

Hello! 

I'm trying to create the Einstein Vision Lightning App per this trailhead (https://trailhead.salesforce.com/projects/build-a-cat-rescue-app-that-recognizes-cat-breeds/steps/cat-recognition-app-ui-einstein-vision). I added the Apex Class and Lightning Component as shown, but when I add the component or try to use it I get this error:
User-added image

Any idea what this is or how to fix?
Thanks!

We have two custom email fields on our Contact object.  I've created a simple flow triggered by process builder to used a web-to-case email address to find all occurances of that email address in one of those fields.  The flow works as follows

1)  Fast Lookup on Contact using the Web Email address to match against an email field. 
2)  Loop and Assignment elements to count the number of occurances
3) Update element to  write out the number of occurances to the Case record. 

Here's the problem.  This works perfectly if the Fast Lookup is checking the standard Email field on the Contact.  However, if I search on a custom email field, the flow fails:  
 
FAST LOOKUP: Find_Person_Account_Matches
Find all Contact records where:
Email_2__c Equals {!WebEmail} (test@email.com)
Sort records by: LastName (Ascending)
Assign those records to {!EmailMatchesFound}.
Save these field values in the variable: Id, IsPersonAccount
Result
Failed to find records.

I have two versions of this flow that are identical except for the field that's being searched.  

(Yes, we're using Person Accounts, but the behaviour is the same if the contact is not a person account.)

Is there any good reason why flow would treat a standard email field differently from a custom email field?

Thank You. 
 
I'm the system admin for a Community and recently I've started getting this error message by email: 

"A new user's attempt to register at NAME_Portal failed because the value for the profileID attribute is either null or invalid. Set the profileID for new users on the ChatterAnswersRegistration Visualforce page for the site associated with community NAME_Portal or on the apex class associated with the Facebook authprovider."

We don't have Chatter Answers enabled and we don't have Facebook set as an Auth Provider so I'm not sure what's going on there. Additionally, we haven't made any changes to our code recently around the self registration. Any thoughts?
Hi All,
I'm stuck. I need a field update formula to extract data from between two characters (in this case commas). 

For Example: 00442178,01,1625196411116,JOSE,OMAR,MEJIA,SANCHEZ,214,

I want to extract the value between the 3rd and 4th comma. The number of commas will be consistent but not the number of characters between them. 

I’ve been able to find the first comma using FIND(“,”, Field__c, 1), but I can’t figure out how to start at the third comma and return all values between it and the fourth comma. Help?

Serena
Hello All!

I’m hoping you can help me with an automation. Here’s the scenario:

I have a org with Advanced Currency Management enabled. I’ve used this Salesforce resolution article (https://help.salesforce.com/articleView?id=000211817&type=1) to recreate my currently rollups and formulas from Payments to Opportunity and those all work fine.

I now have a new requirement to automate the creation of payment records using values from some custom fields that we’ve added to Opportunity. I’ve been able to do this via a process builder which fires on creation of a new Opportunity with the relevant fields populated (see below).

User-added image

When the Payment record(s) are created the “Total Payments” custom rollup is also populating correctly (see below). 
User-added image

The problem is with my Balance Due field. This field is populated using a workflow which fires on creation and edit to calculate the value (Amount - Total Payments) and then populate it into a custom currency field. (This path is due to Advanced Currency Management being enabled.)

Currently, my custom Balance Due field is not updating upon the creation of the Opportunity and Payment records. It stays set to the initial Amount - Total Payments value. If I edit and save the Opportunity record then my workflow fires and the field updates.

I think this might be an order of operations issue, since both the opportunity and payment records are being created at once, but I’m not sure. 

For the moment, I've added a scheduled action to my process builder to repopulate a field on the opportunity with its previous contents to force an edit/save which would run the workflow for my Balance Due field, but I can’t schedule that to happen any sooner than 1 hour after the records are created which is not ideal.

Any thoughts on other ways to get the Balance Due workflow to fire immediately after the records are created so that it updates correctly right away?

Thanks!
Serena
Hello! 

I'm trying to create a workflow rule/field update formula to to replace first digit in phone number field with "+256". (Example: 0702475002 should be +256702475002).

I've tried the following two forumulas so far without luck - any help would be appreciated!! 

if(begins (Phone_Number__c, "0"), 
substitute(Phone_Number__c,"0", “+256"),"")


IF(BEGINS(Phone_Number__c,"0"), RIGHT(Phone_Number__c,1), “+256”)

Serena
Hi All,

I have integrated mailchimp with salesforce account . It successfully fetched subscriber list from mailchimp but it not working mailchimp  subscribers add  as Lead  into salesforce. I have implemented lead Assignment Rule on Create new Lead . It work fine without lead Assignment Rule but with lead Assignment Rule its show Validation rule error and subscriber not add as lead into salesforce,

So kindly guide me what i have to do for this problem.

Thanks
Hi,

We are having issues with transferring user from our app to Salesforce1 app. We are trying to open record created in our app with SF1. In iOS platform we got it working by calling this: 
com.salesforce.salesforce1://sObject/#recordid#/view
Replace: #recordid# with object id.
Same doesn't work on Android. Neither does the the version you have documented here:
http://help.salesforce.com/HTViewSolution?id=000213748
or here:
https://resources.docs.salesforce.com/sfdc/pdf/salesforce1_url_schemes.pdf

Anyone got these to work on Android?