• MikeyJamJams
  • NEWBIE
  • 35 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 11
    Replies
Hello, 

I am exploring how to leverage Salesforce CMS for internal users. CMS was built around Experience Cloud, and displaying your content to external users, as the Experience Builder allows you to add CMS Lightning Components to your communities to pull in single pieces of content as well as collections. However, none of this is available for internal users. We would like to use CMS internally, so that content can be displayed on Lightning home pages for internal users. To do this we need to create custom components, but the process of querying and accessing CMS data seems very cumbersome. 

As far as I can tell, CMS is managed within the ManagedContent object. Unfortunately, this object is not available through SOQL. Instead, you have to use the ConnectAPI to access this information. There are a number of methods available to retrieve the CMS data, as listed here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_ConnectAPI_ManagedContent_static_methods.htm#apex_ConnectAPI_ManagedContent_methods

However, all of these functions appear to be intended for external audience, as they want you to supply a channel id, or a community id of where the content is to be hosted. I'm looking to do something much more simpler, such as retrieve an image simply based on the name. 

I'm curious if others have tried to query for CMS content in a similar manner, and if you could provide an example, that would be wonderful! 

Thanks,
Mikey
Hey everyone. I'm very new to Lightning components, so I'm hoping this will be a relatively easy answer for the experts on here.  I have a very simple Lightning Web Component embedded inside a parent Aura Component. What I would like to do is be able to have my parent Aura Controller retrieve the property value from my child LWC, but I can't figure out how. 

For example, here is my simple LWC HTML file that returns Hello World.
samplelwc.html
<template>
    <lightning-card  title="Sample LWC">
        <p class="slds-p-horizontal_small">My LWC variable is: {lwcVariable}</p>
    </lightning-card>
</template>
samplelwc.js
import { LightningElement, api } from 'lwc';

export default class Samplelwc extends LightningElement {
    @api lwcVariable = 'Hello World';
}

In my Aura Component, I would like to retrieve lwcVariable from my LWC controller, but I can't figure out how to do this.

Here is the Aura Compoent I have:
sampleac.cmp
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
    <c:samplelwc aura:id="mylwc"/>
    <aura:attribute name="lwcVariable" type="String"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <lightning:card title="Sample Aura Component">
        <p class="slds-p-horizontal_small">The variable from my aura controller is: {!v.lwcVariable}</p>
    </lightning:card> 
</aura:component>
What I would like to do is have {!v.lwcVariable} pulled from my LWC, but I can't figure it out. Right now I'm hardcoding it with Hello World! as shown in my Aura Controller. I'm not sure how to have the component.set method pull the value from my lwcVariable property in my LWC Controller.
sampleacController.js
({
    doInit : function(component, event, helper) {
        component.set("v.lwcVariable", "Hello World!");
    }
})
If any help is greatly appreciated. Thanks!

 
 
Hello,

I have a custom related list built on a Visual Force that we have embedded on the Account Layout. This related list shows a series of custom Sales Team records. Above the related list, we have a picklist that displays various regions. We want users to be able to use this picklist as a filter so that when they select a region from the dropdown and click a button, the related list filters to only display the records who region matches the value selected in the picklist.

I am having trouble getting the selected value in the picklist to be referenced in my Apex Class.

Here is a subset of my code:

This is my Region picklist. It pulls the list of values from an Apex function
<apex:selectList size="1" id="regionfilter">
        <apex:selectOptions value="{!DistinctRegionValuesFilter}"></apex:selectOptions>
    </apex:selectList>


This is my button on the form. The attribute I am having trouble with is the value attribute. I want to pass in the selected picklist value, but that is not happening. Instead, my debugs show that my region parameter is null:
<apex:commandButton value="Go" action="{!refreshRelatedList}" reRender="form">
    <apex:param name="region" value="regionfilter"/>
    </apex:commandButton>

However, if I hardcode the value attribute to one of my regions, such as USA, whenever I click the button, it successfully filters my related list to only show Sales Teams with USA as the region.
<apex:commandButton value="Go" action="{!refreshRelatedList}" reRender="form">
    <apex:param name="region" value="USA"/>
    </apex:commandButton>

I feel like I'm close, so does anyone know of a simple way I can have the selected picklist value be stored as my apex parameter?

Thanks!
Mikey

Hello,

 

I have am embedded VisualForce page on one my custom objects. There is a lookup field, Attendee, and I cannot enable my page so that when a user clicks the Attendee, it opens the Attendee's detail page in the main window. Instead, it opens the Attendee's detail page within the embedded VisualForce page.

 

I have the following code for this field, and I can't figure out what to do. I've also tried using <apex:commandLink> instead, but I had no luck there, either.

 

            <apex:column headerValue="Attendee">
                <apex:outputLink value="/{!att.Attendee__c}" target="_parent">
                    <apex:outputField value="{!att.Attendee__c}" />
                </apex:outputLink>
            </apex:column>

 

If anyone could help that would be awesome. This is driving me crazy, and I can't imagine it's that hard of a fix. I've even tried target="_blank" but the the Attendee page still opens in the embedded VisualForce rather than a new window.

 

Also, I'm not sure if it's acting weird because of the <apex:outputField> tag because when I use the following code, it works, meaning the record page opens in the main window. However, instead of displaying the Attendee's Name, it displays their record ID, which I don't want, which is why I resorted to outputField.

 

            <apex:column headerValue="Attendee">
                <apex:outputLink value="/{!att.Attendee__c}" target="_parent">
                    {!att.Attendee__c}
                </apex:outputLink>
            </apex:column>

 

I've created a VisualForce page that I have embedded on the Account Page Layout. It serves as a custom Opportunity Related List, with the ability to Edit and Delete Opportunities. Whenever I delete Opportunities, my JavaScript action function is set up so that the VisualForce form refreshes and the deleted record is no longer visible. However, how can I refresh the Account Page in which the VisualForce is embedded. 

 

From looking at code, it seems it has to potentially do with the reRender attribute, but I'm not sure if the reRender attribute only affects the embedded VisualForce page. Here is the code I have for my embedded VisualForce.

<apex:page standardController="Account" extensions="opportunityRelatedList,deleteOpportunityRelatedListRecords">
<apex:form id="form">
    <apex:pageBlock title="Large Opportunities">  
        <apex:pageBlockTable value="{!FilteredOpportunities}" var="opp">        
            <apex:column >
                <apex:outputLink value="/{!opp.id}/e?retURL=/{!opp.AccountId}" target="_parent"> Edit </apex:outputLink>&nbsp;|             
                <a href="Javascript&colon;if (window.confirm('Are you sure?'))JSDeleteRecords('{!opp.Id}');"> Del </a>                                                             
            </apex:column>          
            <apex:column value="{!opp.Name}" />
            <apex:column value="{!opp.Amount}" />
        </apex:pageBlockTable>
    </apex:pageBlock>

<apex:actionFunction name="JSDeleteRecords" action="{!DeleteRecords}" reRender="form">   
    <apex:param name="oppID" value=""/></apex:actionFunction>   
</apex:form> 
</apex:page>

 

Do I need to put some JavaScript command in the rerender attribute so that the Account page will refresh?

Thanks!

Mikey

Hi everyone,

 

I guess this is an "Is this possible?" question. In our current setup we are using the standard Contact object, and users create custom Accommodation records through an Accommodations related list on the Contact record. I know I can create a custom "New Accommodation" button on the related list that allows us to pass Contact fields in the URL and pre-fill fields on the Accommodation Record Edit page.

 

However, on our contact page, we have a VisualForce page embedded as its own section. It does some caluculations with related objects and displays these values. Is it possible to pass a value from the embedded VisualForce page in my URL. and if so, how can I do that? Or, can I only pass values stored directly on the Contact record itself?

 

Thanks!

Mikey

Hello,

 

I have the following trigger, aimed to populate a Contact Lookup field with the Contact Id of a related record called Rep ID.

 

Here is the trigger I have:

trigger AccommodationsBeforeTrigger on Accommodations__c (before insert, before update) 
{
    for (Accommodations__c a: trigger.new)
    {
        a.Contact__c = a.Rep_ID__r.Contact__r.Id;
    } 
}

 

This trigger is returning a blank value for the Contact lookup field whenever a record is saved.

However, what's interesting is that if I create a formula field, and use my trigger to set the Contact lookup value equal to this formula field, it works. 

For example, I created a Formula field: test__c whose value is Rep_ID__r.Contact__r.Id.

 

Then, I adjusted my trigger to the following

trigger AccommodationsBeforeTrigger on Accommodations__c (before insert, before update) 
{
    for (Accommodations__c a: trigger.new)
    {
        a.Contact__c = a.Test__c;
    } 
}

 I don't get why it works this way and not the first way since the formula code is the same as the code in my first trigger example. I'd like the trigger to work without the need to create a separate field.

 

Thanks!

Mikey

Hello,

 

We have a business request to build a series of cascading picklists using field dependencies, where the top picklist controls what displays in the 2nd, the 2nd picklist controls what displays in the third, etc.

 

Is there a limit to how many levels down we can go in this type of field dependency relationship?

 

Thank you,

Mike

Hello, I'm fairly new to triggers, but I've set up a very simple trigger to kick off an approval process whenever an account's address information is changed.

trigger Updated_Customer_Approval_Process on Account (after update) 
{
   
    for(Account a: trigger.new){ 

    if (
         trigger.oldmap.get(a.id).Name <> a.Name || 
	 trigger.oldmap.get(a.id).ShippingStreet <> a.ShippingStreet ||
         trigger.oldmap.get(a.id).ShippingCity <> a.ShippingCity || 
         trigger.oldmap.get(a.id).ShippingState <> a.ShippingState ||
         trigger.oldmap.get(a.id).ShippingPostalcode <> a.ShippingPostalCode ||
	 trigger.oldmap.get(a.id).ShippingCountry <> a.ShippingCountry
        )
    {
    Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
    req1.setComments('The following customer, ' + a.Name + ', has been updated and requires your approval.');
    req1.setObjectId(a.id);
    Approval.ProcessResult result = Approval.process(req1);}
    
}}

If the Account is rejected, I have set up several Rejection Field Updates so that the fields would return to the previous data values:

PRIORVALUE(Name)

PRIORVALUE(ShippingStreet)

PRIORVALUE(ShippingCity)

PRIORVALUE(ShippingState)....etc.

 

However, none of these field updates work. Instead of returning the prior value, they return the current value that the user just entered.

 

 

Since this didn't work, I also tried using a workflow rule. Basically, I created a workflow rule that ran every time a record is created or edited, and stored the prior value of the address fields into additional custom fields I had created. However, this workflow seems to conflict with the approval process I created, because I get the following error.

 

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger Updated_Customer_Approval_Process caused an unexpected exception, contact your administrator: Updated_Customer_Approval_Process: execution of AfterUpdate caused by: System.DmlException: Process failed. First exception on row 0; first error: ALREADY_IN_PROCESS, Cannot submit object already in process.: []: Trigger.Updated_Customer_Approval_Process: line 19, column 1".

 

My question is, Do I need to use Apex to recall the previous address information if the account is rejected through the Approval Process? If so, would this require a new Trigger to be kicked off after the request is rejected, and if so, how would I go about doing that.

 

Thanks!

Mike

Hello, We have an approval process in place so that when a user updates an Account Shipping Address, the user submits an approval request, and if these changes are rejected, they are to revert back to the previous value.

 

I've set up our approval process so that whenever an approval request gets rejected, five field updates are kicked off, using the following formulas

PRIORVALUE(ShippingStreet)

PRIORVALUE(ShippingCity)

PRIORVALUE(ShippingState)

PRIORVALUE(ShippingPostalCode)

PRIORVALUE(ShippingCountry)

 

However, whenever I test out our process by changing one of these values, submitting a request for approval and then rejecting it, none of the fields revert back to their original value. I'm not sure what I'm doing wrong if someone could help provide some insight.

 

Thanks,

Mike

 

Hey everyone. I'm very new to Lightning components, so I'm hoping this will be a relatively easy answer for the experts on here.  I have a very simple Lightning Web Component embedded inside a parent Aura Component. What I would like to do is be able to have my parent Aura Controller retrieve the property value from my child LWC, but I can't figure out how. 

For example, here is my simple LWC HTML file that returns Hello World.
samplelwc.html
<template>
    <lightning-card  title="Sample LWC">
        <p class="slds-p-horizontal_small">My LWC variable is: {lwcVariable}</p>
    </lightning-card>
</template>
samplelwc.js
import { LightningElement, api } from 'lwc';

export default class Samplelwc extends LightningElement {
    @api lwcVariable = 'Hello World';
}

In my Aura Component, I would like to retrieve lwcVariable from my LWC controller, but I can't figure out how to do this.

Here is the Aura Compoent I have:
sampleac.cmp
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
    <c:samplelwc aura:id="mylwc"/>
    <aura:attribute name="lwcVariable" type="String"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <lightning:card title="Sample Aura Component">
        <p class="slds-p-horizontal_small">The variable from my aura controller is: {!v.lwcVariable}</p>
    </lightning:card> 
</aura:component>
What I would like to do is have {!v.lwcVariable} pulled from my LWC, but I can't figure it out. Right now I'm hardcoding it with Hello World! as shown in my Aura Controller. I'm not sure how to have the component.set method pull the value from my lwcVariable property in my LWC Controller.
sampleacController.js
({
    doInit : function(component, event, helper) {
        component.set("v.lwcVariable", "Hello World!");
    }
})
If any help is greatly appreciated. Thanks!

 
 
In Lightning Experience, when I'm on a record and select "Activity", I get only "New Task" and "New Event".  How can I get Email and Log Call on there, like they're supposed to be? 
Hello,

We've set up a new community using the Community designer from Winter release 14 and when we click on "Contact Support" from the main page or from the "Post To" option in the "Ask the Community" dropdown, we get an error saying:

"Either this publisher action does not exists or you dont have access to it: NewCase"

Here is a screencast of what we see:
http://screencast.com/t/lpcajr2Ov

Please help!

I found this formula referenced by a few people:

https://help.salesforce.com/HTViewHelpDoc?id=formula_examples_dates.htm&language=en_US

I'm using it to find the business age between a custom date time field called First Contact Date and the Case Created Date. We want a 12 hour day starting at 7:00 AM. Everything works fine except when the date created is between midnight and 7:00 AM. When the date created is between those hours, the value returned in the formula is a negative number. How can I fix this? I created test datetime fields so that I can test the formula with different values. Here's the formula using the test fields. Any advice?

ROUND(12*(
(5*FLOOR((DATEVALUE(Test_First_Contact_Date__c)-DATE(1996,01,01))/7) +
MIN(5,
    MOD(DATEVALUE(Test_First_Contact_Date__c)-DATE(1996,01,01), 7) +
    MIN(1, 24/12*(MOD(Test_First_Contact_Date__c-DATETIMEVALUE('1996-01-01 12:00:00'), 1)))
))
-
(5*FLOOR((DATEVALUE(Test_DateCreated__c)-DATE(1996,01,01))/7) +
MIN(5,
    MOD(DATEVALUE(Test_DateCreated__c)-DATE(1996,01,01), 7) +
    MIN(1, 24/12*(MOD(Test_DateCreated__c-DATETIMEVALUE('1996-01-01 12:00:00'), 1)))
))
), 2)

I am trying to get the native lookup window to open up and when the value is selected needs to populate a hidden field.

I am able to call the lookup function, but when i select the value nothing happens, the lookup window doesnt close and value is not posted into the hidden field.

 

function showLookup(ctrlID,objKeyPrefix) 
    { 
        openLookup("/_ui/common/data/LookupPage?lkfm=ConvertwithInputs:pbmconvertInput:pbformmconvertInput&lknm="+ ctrlID +"&lktp="+objKeyPrefix,500);           
     }

<apex:inputText id="vField_AccountName_lkid" value="{!s.selectedAccount}"/>           
<apex:image url="/s.gif" alt="Lookup (New Window)" styleClass="lookupIcon" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onclick="javascript&colon;showLookup('ConvertwithInputs:pbmconvertInput:pbformmconvertInput:pbsmconvertInput:pbspbtable:' + jQuery(this).closest('tr').prevAll('tr').length + ':vField_AccountName','001')" title="Lookup (New Window)"/>

 

The url generated in the lookup used by the above window is

https://c.na15.visual.force.com/_ui/common/data/LookupPage?lkfm=ConvertwithInputs:pbmconvertInput:pbformmconvertInput&lknm=ConvertwithInputs:pbmconvertInput:pbformmconvertInput:pbsmconvertInput:pbspbtable:0:vField_AccountName&lktp=001

The url when you click on search result is

https://c.na15.visual.force.com/_ui/common/data/LookupResultsFrame?lktp=001&lknm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput%3ApbsmconvertInput%3Apbspbtable%3A0%3AvField_AccountName&lkfm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput#

To test the urls i also had a standard lookup and the url generated is

https://c.na15.visual.force.com/_ui/common/data/LookupPage?lkfm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput&lknm=massConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput%3ApbsmconvertInput%3Apbspbtable%3A0%3Aj_id7&lktp=001&lksrch=

The link on the search result for standard lookup is

https://c.na15.visual.force.com/_ui/common/data/LookupResultsFrame?lktp=001&lknm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput%3ApbsmconvertInput%3Apbspbtable%3A0%3Aj_id7&lksrch=&lkfm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput#

The standard lookup for standard lookup field works fine

Where does the closing of lookup window happen?

Any pointers on what is happening while clicking of search result, where does the closing and assigning of value happen?

Thanks

Hello,

 

I have am embedded VisualForce page on one my custom objects. There is a lookup field, Attendee, and I cannot enable my page so that when a user clicks the Attendee, it opens the Attendee's detail page in the main window. Instead, it opens the Attendee's detail page within the embedded VisualForce page.

 

I have the following code for this field, and I can't figure out what to do. I've also tried using <apex:commandLink> instead, but I had no luck there, either.

 

            <apex:column headerValue="Attendee">
                <apex:outputLink value="/{!att.Attendee__c}" target="_parent">
                    <apex:outputField value="{!att.Attendee__c}" />
                </apex:outputLink>
            </apex:column>

 

If anyone could help that would be awesome. This is driving me crazy, and I can't imagine it's that hard of a fix. I've even tried target="_blank" but the the Attendee page still opens in the embedded VisualForce rather than a new window.

 

Also, I'm not sure if it's acting weird because of the <apex:outputField> tag because when I use the following code, it works, meaning the record page opens in the main window. However, instead of displaying the Attendee's Name, it displays their record ID, which I don't want, which is why I resorted to outputField.

 

            <apex:column headerValue="Attendee">
                <apex:outputLink value="/{!att.Attendee__c}" target="_parent">
                    {!att.Attendee__c}
                </apex:outputLink>
            </apex:column>

 

I've created a VisualForce page that I have embedded on the Account Page Layout. It serves as a custom Opportunity Related List, with the ability to Edit and Delete Opportunities. Whenever I delete Opportunities, my JavaScript action function is set up so that the VisualForce form refreshes and the deleted record is no longer visible. However, how can I refresh the Account Page in which the VisualForce is embedded. 

 

From looking at code, it seems it has to potentially do with the reRender attribute, but I'm not sure if the reRender attribute only affects the embedded VisualForce page. Here is the code I have for my embedded VisualForce.

<apex:page standardController="Account" extensions="opportunityRelatedList,deleteOpportunityRelatedListRecords">
<apex:form id="form">
    <apex:pageBlock title="Large Opportunities">  
        <apex:pageBlockTable value="{!FilteredOpportunities}" var="opp">        
            <apex:column >
                <apex:outputLink value="/{!opp.id}/e?retURL=/{!opp.AccountId}" target="_parent"> Edit </apex:outputLink>&nbsp;|             
                <a href="Javascript&colon;if (window.confirm('Are you sure?'))JSDeleteRecords('{!opp.Id}');"> Del </a>                                                             
            </apex:column>          
            <apex:column value="{!opp.Name}" />
            <apex:column value="{!opp.Amount}" />
        </apex:pageBlockTable>
    </apex:pageBlock>

<apex:actionFunction name="JSDeleteRecords" action="{!DeleteRecords}" reRender="form">   
    <apex:param name="oppID" value=""/></apex:actionFunction>   
</apex:form> 
</apex:page>

 

Do I need to put some JavaScript command in the rerender attribute so that the Account page will refresh?

Thanks!

Mikey

Hello,

 

I have the following trigger, aimed to populate a Contact Lookup field with the Contact Id of a related record called Rep ID.

 

Here is the trigger I have:

trigger AccommodationsBeforeTrigger on Accommodations__c (before insert, before update) 
{
    for (Accommodations__c a: trigger.new)
    {
        a.Contact__c = a.Rep_ID__r.Contact__r.Id;
    } 
}

 

This trigger is returning a blank value for the Contact lookup field whenever a record is saved.

However, what's interesting is that if I create a formula field, and use my trigger to set the Contact lookup value equal to this formula field, it works. 

For example, I created a Formula field: test__c whose value is Rep_ID__r.Contact__r.Id.

 

Then, I adjusted my trigger to the following

trigger AccommodationsBeforeTrigger on Accommodations__c (before insert, before update) 
{
    for (Accommodations__c a: trigger.new)
    {
        a.Contact__c = a.Test__c;
    } 
}

 I don't get why it works this way and not the first way since the formula code is the same as the code in my first trigger example. I'd like the trigger to work without the need to create a separate field.

 

Thanks!

Mikey

Hello, We have an approval process in place so that when a user updates an Account Shipping Address, the user submits an approval request, and if these changes are rejected, they are to revert back to the previous value.

 

I've set up our approval process so that whenever an approval request gets rejected, five field updates are kicked off, using the following formulas

PRIORVALUE(ShippingStreet)

PRIORVALUE(ShippingCity)

PRIORVALUE(ShippingState)

PRIORVALUE(ShippingPostalCode)

PRIORVALUE(ShippingCountry)

 

However, whenever I test out our process by changing one of these values, submitting a request for approval and then rejecting it, none of the fields revert back to their original value. I'm not sure what I'm doing wrong if someone could help provide some insight.

 

Thanks,

Mike

 

 

Hi All,

 

I have written a trigger and a test class for that. Test coverage for the trigger is 100% in sandbox. When I try to move it to Production, I get this error.(Please note it is a  bulkified trigger.).

 

TestBC_AverageAmountNew.ideaBatchTest()Class291Failure Message: "System.LimitException: Too many SOQL queries: 101", Failure Stack Trace: "Trigger.BookingQuota: line 29, column 1"

 

The above class "TestBC_AverageAmountNew" has been written for a batch class.

I am unable to understand how is the trigger related to above test class and how can I remove the error.

 

Any help would be greatly appreciated.

 

Thanks,

Alok

Hello,

 

I've seen a number of posts regarding this issue, but none have been responded to so I'm hoping there might be more information now.

 

The problem is that I have a custom button which allows you to close a case with one click, the button basically sends you to this URL:

 

https://na5.salesforce.com/{!Case.Id}/s?save=1&cas7=Closed

 

This functionality depends on the "save=1" part of the link, which saves the record without having to click on the save button.

 

This is currently working in an older org I have, but not in any new orgs.  What happens if you try to pass "save=1" you get an error saying,

 

"Error: Invalid Data. 
Review all error messages below to correct your data.
The page you submitted was invalid for your session. Please click Save again to confirm your change."

 

Does anyone know if this behavior has changed?  Or even better, a way to do this now that there seems to be issues?

 

Thank you!

Brendan