How to create Process Variables through Custom Connector Logic Code

I wanted to understand if there is a way by which we can create process variables from Java Code of Connector Logic.directly. Thanks!

You could probably use the gRPC API to set variables on a process instance.

Hey Thanks @rohwerj for the reply, I am very new to this, how can I use it in my connector logic for a self managed environment in the desktop modeler?

You have to place your connector templates in the file system, for them to be picked up by the desktop modeler:

Also my previous answer was not the best solution, because you can directly define input and output mappings for you connector. Have a look at:

Yeah, the connector is running all fine in my desktop modeler, the only part I want is to make my connector logic create some process variables that could be used in the entire process, I know that we can create them using the connector template but not sure how to make a function that is able to define some process variables. Thanks

If I understand your problem correctly, maybe this small example helps.
With the connector template:

...
  "properties": [
    {
      "label": "Some Input",
      "type": "String",
      "feel":"optional",
      "group": "input",
      "binding": {
        "type": "zeebe:input",
        "name": "someInput"
      }
    },
    {
      "label": "Result Variable",
      "description": "Name of the result variable.",
      "group": "output",
      "type": "String",
      "binding": {
        "type": "zeebe:taskHeader",
        "key": "resultVariable"
      }
    }
  ]

Now the result of your connector function will be assigned to the variable you choose in the property for the result variable.
You can also choose to use a resultExpression to map your result to a set of variables.