Hello,
I am new to CRM and have to solve some errors in our new IT service management.
First of all: I want to change ticket status from New/Open to Active, when an employee from Service-Desk change something in this ticket after creation by a client.
The following code works: When a ticket status is solved and a client rated our service with 6, then the ticket status should be modified to active:
lr_coco ?= me->comp_controller.
IF lr_coco->gv_status_old = 'E0005'.
lr_current = lr_coco->ztyped_context->btcustomerh->collection_wrapper->get_current( ).
IF lr_current IS BOUND.
lr_current->get_property_as_value( EXPORTING iv_attr_name = 'ZZINCID_RATING' IMPORTING ev_result = lv_rating ).
IF lv_rating = 6.
lr_adminh = lr_coco->typed_context->btadminh->collection_wrapper->get_current( ).
IF lr_adminh IS BOUND.
entity ?= lr_adminh.
coll = entity->get_related_entities( iv_relation_name = 'BTHeaderStatusSet' ). "#EC NOTEXT
lr_adminh = coll->get_current( ).
IF lr_adminh IS NOT BOUND.
RETURN.
ENDIF.
entity ?= lr_adminh.
coll = entity->get_related_entities( iv_relation_name = 'BTStatusHCurrent' ). "#EC NOTEXT
lr_adminh = coll->get_current( ).
IF lr_adminh IS NOT BOUND.
RETURN.
ENDIF.
lr_adminh->set_property( iv_attr_name = 'ACT_STATUS' iv_value = 'E0007' ).
lr_adminh->set_property( iv_attr_name = 'ACTIVATE' iv_value = 'X' ).
lr_adminh->set_property( iv_attr_name = 'STATUS' iv_value = 'E0007' ).
* lr_coco->typed_context->btadminh->collection_wrapper->publish_current( ).
BOL_CORE = cl_crm_bol_core=>get_instance( ).
bol_core->modify( ).
ENDIF.
ENDIF.
ENDIF.
ENDIF.
but the following code doesn't work and I don't know what I can do with it:
IF lr_coco->gv_status_old = 'E0001' or lr_coco->gv_status_old = 'E0002'.
lr_adminh = lr_coco->typed_context->btadminh->collection_wrapper->get_current( ).
entity ?= lr_adminh.
coll = entity->get_related_entities( iv_relation_name = 'BTHeaderStatusSet' ). "#EC NOTEXT
lr_adminh = coll->get_current( ).
entity ?= lr_adminh.
coll = entity->get_related_entities( iv_relation_name = 'BTStatusHCurrent' ). "#EC NOTEXT
lr_adminh = coll->get_current( ).
lr_adminh->set_property( iv_attr_name = 'ACT_STATUS' iv_value = 'E0007' ).
lr_adminh->set_property( iv_attr_name = 'ACTIVATE' iv_value = 'X' ).
lr_adminh->set_property( iv_attr_name = 'STATUS' iv_value = 'E0007' ).
bol_core = cl_crm_bol_core=>get_instance( ).
bol_core->modify( ).
ENDIF.
I hope you can help me. Likely it is a small fault, but I spend a few hours in this small change.
Thanks in advance.
Fabian