Manage attachments on public record producer in Service Portal

gauravshurvir
Giga Contributor

Hi,

I have created a record producer to capture some information from the user who does not have any role on the instance. It is available for the public. I am rendering it through Service Portal. Have also created some widgets on the portal page. Everything is working fine except attachments. User with some role can easily add/remove attachments on the page but when user without any role  (public user) is trying to attach, nothing is happening. In the console i see an error

find_real_file.png

Has anyone encountered this error ? If yes, can you please advise some workaround.

 I am using attachment widget to manage attachments:

 

find_real_file.png

20 REPLIES 20

I dont think it makes a difference if it is CSM or not. The record producer should work in the same way. It might be due to your platform version (i think the code above works with quebec).

You can add a "debugger;" statement at different lines of the client controller. If you open the developer console on your browser and then upload, you will be able to debug the code very easily.

Where have you defined the functions:

getRecordTableName()
getRecordId()

The OOTB widget is being wrapped and i'm injecting the logic that is required to enable to "public" part. Both of the functions are defined in the child scope, see this line (afterwards i'm binding the child scope to the function call)

c.childScope.$watch('onAttachmentSelect', function(newValue, oldValue, scope) {	

 

choff
Tera Contributor

Thank you for this. It is a brilliant solution to a frustrating problem.

However, I am still receiving an unspecified error on my field when I try to submit my form.

ApplicationFrameHost_y2MwPFQEke.png

(Attach CV is the name of the Custom with Label variable)

There is nothing in the console and nothing relevant I can find in the debugger. The widget seems to do its job flawlessly right up until it's time to submit. I've tried making it non-mandatory in addition to other changes with no luck.

 

We are on Vancouver.

Mario Sanz
Tera Expert

Hello everyone. The widget @Krauzi posted here does work. You just have to save the widget in a scope and make the next change in "Client Controller":

You must initialize to false before the if.

 

MarioSanz_0-1708638509969.png