3

I have a public site/page that uses a visual workflow to create a task based on inputs. However, because guests do not have the permissions to create tasks or events - I need to figure out an alternative way to do this.

One way I thought would be to login as a system administrator or other user with sufficient permissions. However, the customer portal and communities does not exist under my Customize Applications.

Is there anyway to enable login on my Visualforce Pages without Customer Portals or Communities?


Have spent 2+ weeks working on this to no avail and would really appreciate any help! Would appreciate any help as I tear my hair out! Thank you!

5
  • Is it possible to set the guest permissions to allow them to the permissions to create tasks or events?
    – blunders
    Apr 27, 2014 at 1:30
  • Unfortunately they are not allowed to change them is what I believe. I decided to get off my butt and write APEX code which works if run as a system admin, but not by guests on the public site. Any ideas there to have the APEX run as though by another user would be appreciated!
    – Jack
    Apr 27, 2014 at 2:35
  • To allow the site guest user to execute Apex code, go to Site config, click Public Access Settings, then add the Apex class in Enabled Apex Class Access.
    – metadaddy
    Apr 27, 2014 at 18:28
  • You'll also need to give the Site Guest User the ability to create Tasks and Events - same Public Access Settings screen.
    – metadaddy
    Apr 27, 2014 at 18:29

3 Answers 3

1

Apologies for not being able to give a more specific answer, but I had eventually solved my issue using the below apex code that I custom wrote. However, it was about 2 years ago and was for a client project which I have since removed my access for.

Hopefully it can be helpful for someone in the future - Cheers!

// Create Task for Sign In
public without sharing class JSDCLSignInTask implements Process.Plugin {
    //runs when called by flow's Apex plug-in element.
    public Process.PluginResult invoke(Process.PluginRequest request) {

        // Set up variables to store input parmeters from the flow
        // String OwnerId = (String) request.inputParameters.get('OwnerId');
        String Priority = (String) request.inputParameters.get('Priority');
        String Status = (String) request.inputParameters.get('Status');
        String Subject = (String) request.inputParameters.get('Subject');
        String Type = (String) request.inputParameters.get('Type');
        String WhoId = (String) request.inputParameters.get('WhoId');
        //Date ActivityDate = (Date) request.inputParameters.get('Date');

        // Create Task
        createTaskSignIn(Priority, Status, Subject, Type, WhoId);

        // Return to flow
        Map<String,Object> result = new Map<String,Object>();
        return new Process.PluginResult(result);
    }

    // Describe plug-in and inputs from and outputs to the flow
    // Implementing this adds the class to the Flow Designer Palette
    public Process.PluginDescribeResult describe() {
        // Set up plugin metadata
        Process.PluginDescribeResult result = new Process.PluginDescribeResult();
        result.description = 'Create sign-in task';
        result.tag = 'Create Sign In Task';

        // Create list of mandatory and optional input params
        result.inputParameters = new
            List<Process.PluginDescribeResult.InputParameter>{
            // Priority (mandatory)
            new Process.PluginDescribeResult.InputParameter('Priority', Process.PluginDescribeResult.ParameterType.STRING, true),
            // Status (mandatory)
            new Process.PluginDescribeResult.InputParameter('Status', Process.PluginDescribeResult.ParameterType.STRING, true),
            // Subject (mandatory)
            new Process.PluginDescribeResult.InputParameter('Subject', Process.PluginDescribeResult.ParameterType.STRING, true),
            // Type (mandatory)
            new Process.PluginDescribeResult.InputParameter('Type', Process.PluginDescribeResult.ParameterType.STRING, true),
            // WhoId (mandatory)
            new Process.PluginDescribeResult.InputParameter('WhoId', Process.PluginDescribeResult.ParameterType.STRING, true)    
        };

        return result;

    }

    // Create Task for Sign In Function
    // createTaskSignIn(Priority, Status, Subject, Type, WhoId);

    public void createTaskSignIn(String Priority, String Status, String Subject, String Type, String WhoId) {
        Task newTask = new Task(
            Priority = Priority,
            Status = Status,
            Subject = Subject,
            Type = Type,
            WhoId = WhoId,
            ActivityDate = Date.today(),
            OwnerId = '005A0000002jz1n'
        );

        Insert newTask;
    }

}
0

No, there is no way to allow login to your site without associating it with a portal (customer or partner) or a community.

0

You could create a custom object and allow the guests to create one of those records. Then you'd need to write a schedulable batch class that runs every 15 minutes to create the Task/Event.

Without knowing your full use case, I can't say as to how the entire process would work but I've done the same in the past to allow external users to interface with your instance and then create the standard object records from the customs object records.

Since the batch class would run as the system admin, you would not have permission issues.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .