How can I signal an abandoned child workflow?

Hi I am trying to signal a child workflow outside of a workflow using newWorkflowStub but getting “Null workflowId. Was workflow started?”, the parent workflow has finished executing.

This is how I started the child workflow

val options =
            ChildWorkflowOptions.newBuilder()
                .setTaskQueue("QUEUE")
                .setParentClosePolicy(ParentClosePolicy.PARENT_CLOSE_POLICY_ABANDON)
                .setWorkflowId("CONSENT")
                .build();
        val child = Workflow.newChildWorkflowStub(UserConsentWorkflow::class.java, options);
        Async.procedure { child.initUserConsentWorkflow(userId) }
        val childExecution = Workflow.getWorkflowExecution(child);
        childExecution.get()

This is how I am trying to signal the child workflow

val workflowOptions = WorkflowOptions.newBuilder().setTaskQueue("QUEUE")
                .setWorkflowId("CONSENT").build();
            val workflow = temporalClient.newWorkflowStub(UserConsentWorkflow::class.java, workflowOptions);
            workflow.submitUserConsent(consent)

Signal Method

   override fun submitUserConsent(consent: Consent) {
        this.consent = consent
        this.isConsentSubmitted = true
    }

There are two types of WorkflowClient.newWorkflowStub methods. The first type is used to start workflow first, and the second is used to connect to an already started workflow. The second type accepts workflowID and doesn’t take WorkflowOptions:

val workflow = temporalClient.newWorkflowStub(UserConsentWorkflow::class.java, "WorkflowID");
workflow.submitUserConsent(consent)