• PRUTHVI ADMIN
  • NEWBIE
  • 15 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Looks like the 'Collaborate' button on any report/dashboard does not allow me to post anything to the chatter. I must be me missing some kind of permission/setting here. The feed tracking on reports/dashboards is enabled. So when there is a change to any of the fields enabled for feed tracking, the changes do appear here. But I wanted to post something using the POST action on chatter publisher. However, the POST action seems to not appear here. Not sure how to bring the chatter publisher with POST, POLL, QUESTIONS on the report/dashboard collaborate button. Please refer to the below screen shot.

User-added image
I have overridden standard 'New' Account button with a custom lightning component by implementing override interface. This works perfectly when initiating the action from Account Home page.
Similarly, if I go to a contact page and click on 'New Account' from the Account lookup, I am being redirected to the newly created Account detail page(I have defined this redirect in the component). However, my expected behavior is that the Account should get created and the user should be redirected back to the contact edit page with the newly created Account filled in the Account lookup field. This behavior can be seen if there is NO override on the Account New button.
As per my observation, as soon as I hit the 'New Account' from lookup Contact edit page, the Contact modal seems to be removed in the background and I am getting redirected to the custom component built for 'New Account' override edit page.
I have seen many posts with similar questions but none of them had a proper answer. I might be missing something as well. One post that had exact requirement as mine can be found in the below link, but unfortunately no one answered :-(. Can someone please help. Thanks.
https://salesforce.stackexchange.com/questions/220661/overriden-standard-new-action-how-to-redirect-a-lightning-component-invoked-f
I am working on building an LWC component for a requirement. I would like to find a way to change/update the properties of an JavaScript Array that contains objects returned from Apex Controller. I tried below code, but there seems to be a javascript error. I tried many ways to change the properties of the object returned by Apex controller. But nothing worked. Code snippet & error details provided below. Can someone please help on this ?
 
public class FetchCPData {
    @AuraEnabled(cacheable=true)
    public static List<PRListWrapper> getPRList(String CPId) {
        List<PRListWrapper> prList = new List<PRListWrapper>();
        for(PR__C pr : [SELECT Id, Status__c, Value__c, (select Id, Name from Opportunities__r limit 1) FROM PR__C WHERE PC__c=:CPId]){
            PRListWrapper prw = new PRListWrapper();
            prw.PRRecord = pr;
            if(!pr.Opportunities__r.isEmpty()) 
            {
                prw.disable = true;
            }else {
                prw.disable = false;
            }
            prList.add(prw);
        }
        return prList;
    }
    public class PRListWrapper{
        @AuraEnabled public Boolean disable;
        @AuraEnabled public PR__C PRRecord;
    }
}

import { LightningElement, api, wire, track} from 'lwc';
import getPRList from '@salesforce/apex/FetchCPData.getPRList';
const actions = [
    { label: 'Delete', name: 'Delete' }
];
const columns = [
    { label: 'Status', fieldName: 'status', editable:'true', type: 'text' },
    { label: 'Bid Value', fieldName: 'value', editable:'true', type: 'currency', typeAttributes: { currencyCode: 'USD'}},
    {
        type: 'action',
        typeAttributes: { rowActions: actions }
    }
]
export default class ShowDataInTable extends LightningElement {
    @api recId;
    @track error;
    @track recSize;
    @track data = [];
    @track columns = columns;
    @wire(getPRList, { CPId : '$recId' }) 
    projectRolesFn ({error , data}){
        if(data){
            const lostFilter = data.filter(element => {
                return element.PRRecord.Status__c!=='Lost';
            });
            this.data = lostFilter.map(element => {
                alert(element.PRRecord.Status__c); //This is fetching data as expected
                alert(element.PRRecord.Value__c);  //This is fetching data as expected
                element.status = element.PRRecord.Status__c; //JavaScript error at this point(error given below)
                element.value = element.PRRecord.Value__c;
                return element;
            });      
            this.recSize = this.data.length;
            this.error = undefined;           
        } else if(error){
            this.error = error;
            this.data = undefined;
        }
    }
}

JavaScript Error:
aura_proddebug.js:43117 Error: Invalid mutation: Cannot set "status" on "[object Object]". "[object Object]" is read-only. at ReadOnlyHandler.set (aura_proddebug.js:1100) at eval (showBiddersInTable.js:81) at Array.map () at ShowBiddersInTable.projectRolesFn (showBiddersInTable.js:79) at WireEventTarget.dispatchEvent (aura_proddebug.js:8329) at Object.next (lds.js:1157) at Subscription.next (lds.js:202) at FilterOnSubscribeBehaviorSubject._nextWithErrorHandling (lds.js:272) at eval (lds.js:304) at Set.forEach ()
I am trying to explore various concepts in lightning. My requirement is pretty simple. I have a zipped static resource with multiple images. I have used the <img> tag in the component and defaulted its src attribute to one of the images. Created a lightning button in the component definition whose action in the controller will change the 'src' attribute value to a different image. However, I am getting the below error in the console when the button is clicked and the image is not getting changed to a new one. Am I missing something here ?

Error: WARNING: AttributeSet.set(): unable to override the value for 'srcvalue=function (cmp, fn) { return fn.add($A.get("$Resource.SachinImages"),"/SachinImages/1image.jpg"); }'. FunctionCallValues declared in markup are constant.

Component definition:
<aura:component >
    <aura:attribute name="srcvalue" type="string" default="{!$Resource.SachinImages+'/SachinImages/1image.jpg'}"/>
    <img class="imgclass" src="{!v.srcvalue}" aura:id="imageid" /> <br/> <br/>
    <lightning:button onclick="{!c.buttonClickAction}" label="Click to start slide"/>
</aura:component>
Controller:
({
    buttonClickAction : function(component, event, helper) {
        var btnlabel = event.getSource().get('v.label');
        var srcval   = component.get('v.srcvalue');
        if(btnlabel == 'Click to start slide')
        {
            var changeNbr = srcval.substring(srcval.lastIndexOf('/') + 1, srcval.lastIndexOf('/') + 2); 
            var finalvalue = '{!$Resource.SachinImages' + '+' +'\'/SachinImages/' + (Number(changeNbr) + 1) +'image.jpg\'}';
            console.log('finalvalue'); -> This value is as expected.
            component.set('v.srcvalue',finalvalue);            
        }
    }    
})
 
Looks like the 'Collaborate' button on any report/dashboard does not allow me to post anything to the chatter. I must be me missing some kind of permission/setting here. The feed tracking on reports/dashboards is enabled. So when there is a change to any of the fields enabled for feed tracking, the changes do appear here. But I wanted to post something using the POST action on chatter publisher. However, the POST action seems to not appear here. Not sure how to bring the chatter publisher with POST, POLL, QUESTIONS on the report/dashboard collaborate button. Please refer to the below screen shot.

User-added image
I am trying to explore various concepts in lightning. My requirement is pretty simple. I have a zipped static resource with multiple images. I have used the <img> tag in the component and defaulted its src attribute to one of the images. Created a lightning button in the component definition whose action in the controller will change the 'src' attribute value to a different image. However, I am getting the below error in the console when the button is clicked and the image is not getting changed to a new one. Am I missing something here ?

Error: WARNING: AttributeSet.set(): unable to override the value for 'srcvalue=function (cmp, fn) { return fn.add($A.get("$Resource.SachinImages"),"/SachinImages/1image.jpg"); }'. FunctionCallValues declared in markup are constant.

Component definition:
<aura:component >
    <aura:attribute name="srcvalue" type="string" default="{!$Resource.SachinImages+'/SachinImages/1image.jpg'}"/>
    <img class="imgclass" src="{!v.srcvalue}" aura:id="imageid" /> <br/> <br/>
    <lightning:button onclick="{!c.buttonClickAction}" label="Click to start slide"/>
</aura:component>
Controller:
({
    buttonClickAction : function(component, event, helper) {
        var btnlabel = event.getSource().get('v.label');
        var srcval   = component.get('v.srcvalue');
        if(btnlabel == 'Click to start slide')
        {
            var changeNbr = srcval.substring(srcval.lastIndexOf('/') + 1, srcval.lastIndexOf('/') + 2); 
            var finalvalue = '{!$Resource.SachinImages' + '+' +'\'/SachinImages/' + (Number(changeNbr) + 1) +'image.jpg\'}';
            console.log('finalvalue'); -> This value is as expected.
            component.set('v.srcvalue',finalvalue);            
        }
    }    
})