Skip to main content
18 events
when toggle format what by license comment
Jan 24, 2023 at 22:25 comment added sfdcfox @MarkC5000 try getRecordNotifyChange, since you're using Apex.
Jan 24, 2023 at 22:23 comment added MarkC5000 @sfdxfox I can create a new post if needed, but I thought I would ask here first. I added additional code with the imperative call and it does set the case status to closed now, but I need to refresh the page to see it displayed. I found a refresh apex method and did that on the record, but that doesn't seem to work. Any ideas?
Jan 24, 2023 at 20:20 vote accept MarkC5000
Jan 24, 2023 at 20:19 vote accept MarkC5000
Jan 24, 2023 at 20:19
Jan 24, 2023 at 20:17 comment added sfdcfox @MarkC5000 You'd still have a JS file, you'd use the invoke method to call the Apex class. You don't need wire, though, you need to call Apex imperatively.
Jan 24, 2023 at 20:09 comment added MarkC5000 sorry last thing, so would this eliminate my need for the javascript file then? Or would I just need to have the javascript file call the apex class and nothing else now?
Jan 24, 2023 at 20:03 comment added sfdcfox @MarkC5000 Yes, you'd have an Apex class similar to the one you had before: public without sharing class CloseCaseController { @AuraEnabled(cacheable=false) public static void closeCase(Id caseId) { Case record = new Case(Id=caseId, Status='Closed'); update record; } }
Jan 24, 2023 at 19:44 comment added MarkC5000 would I implement this in the JS file or now I will need to create an apex class like I had before?
Jan 24, 2023 at 19:41 comment added sfdcfox @MarkC5000 Yes, you'll have to set up your sharing appropriately; using without sharing is not a good idea. If you really need to, though, you could use an @AuraEnabled method on a without sharing class if there's really no other solution.
Jan 24, 2023 at 19:32 comment added MarkC5000 I republished the page and then it started coming through the only thing is now I get a 403 uncaught in promise error for the update record. When I originally did this using visualforce I used without sharing in my apex class to get around permission issues. Do you think that could be giving me issues in the JS file since it doesn't have anything like that?
Jan 24, 2023 at 19:11 comment added sfdcfox @MarkC5000 Hmm, I only have limited experience with Digital Experiences. Do you see the case Id in the URL? It might also be a limitation based on where you're placing the component. Is it directly on the page, or inside another component? Can you share a screenshot?
Jan 24, 2023 at 19:00 comment added MarkC5000 I found this developer.salesforce.com/docs/component-library/documentation/… and updated my xml, but still get the undefined. It's just a button on top of the case detail on the community page. Do you think it could really be undefined or it's just still not picking it up?
Jan 24, 2023 at 18:19 comment added sfdcfox @MarkC5000 Don't mix @api recordId and set recordId. Use one or the other. If you're not making a Quick Action, that's fine, too. Your code looks like it should work if you remove the set recordId part.
Jan 24, 2023 at 18:12 comment added MarkC5000 @sfdxfox it does not seem to get called. I added my xml above. Do I need to add additional details in that file for this to all work?
Jan 24, 2023 at 18:09 comment added sfdcfox @MarkC5000 set recordId(...) should work. This is basically the same code as from the documentation, except with the newer # prefix instead of _. What problems are you having?
Jan 24, 2023 at 18:04 comment added MarkC5000 I have added some more code and got the button outside the chatter feed this way, just not able to set the record id.
Jan 24, 2023 at 16:36 comment added MarkC5000 so are you saying I would not need to include a .html file in this case? Would doing it this way get the button outside of the chatter feed? I Included an image above. I don't want the button to be part of the chatter feed, but outside of it as an actual button. That is how I had it with the visualforce page.
Jan 24, 2023 at 15:21 history answered sfdcfox CC BY-SA 4.0