George - 2024-07-18

Good morning everyone, I'm trying to use an additional method in the sv-auto-dispatch-master extension to make sure that after creating a request, it changes the org_id not to the organization of the initiator of the request, but to the id of the organization of the service provider to which the request is linked, and how to check whether everything is working fine or not. I am attaching the code below:

<method id="UpdateOrgIdFromService" _delta="define">
                    <comment><![CDATA[/**
                * Updating the org_id for the organization associated with the service
                */]]></comment>
                    <static>false</static>
                    <access>public</access>
                    <type>Custom</type>
                    <code>
                    <![CDATA[
                        public function UpdateOrgIdFromService() {
                            $oService = MetaModel::GetObject('Service', $this->Get('service_id'), false);
                            if ($oService) {
                                $iProviderOrgId = $oService->Get('provider_id');
                                if ($iProviderOrgId) {
                                    $this->Set('org_id', $iProviderOrgId);
                                }
                            }
                            $this->ApplyStimulus('ev_dispatch');
                        }
                    ]]>
                    </code>
                </method>