Finding line-items related to a contract

Hi,

I’m using the rest interface to access our suite-crm instantiation (hosted at sales agility), and I need to get the line-items that belong to a contract. I do however only get empty lists back, while when I look in the gui, the contract does clearly have line-items. My call goes like this:

Array
(
[session] => <my_session>
[module_name] => AOS_Contracts
[module_id] => <my_contract_id>
[link_field_name] => aos_products_quotes
[related_fields] => Array
(
[0] => id
)

[related_module_query] => 
[deleted] => 0

)

and this is then used to call ‘get_relationships’

What am I doing wrong?

Cheers,

Kristofer

Hi Kristofer,

The link_field_name shouldn’t be the module name but the name of the link to that module in AOS_Contracts. This can be found in AOS_Contracts/vardefs.php.

Try replacing the link_field_name with aos_contracts_aos_products_quotes.

Thanks,
Jim

1 Like

Thanks for the reply Jim. I am afraid this does not do it. When doing the following:

[session] => <my_session>
[module_name] => AOS_Contracts
[module_id] => <contract id>
[link_field_name] => aos_contracts_aos_products_quotes
[related_fields] => Array
    (
        [0] => id
    )

[related_module_query] => 
[deleted] => 0

I still get nothing back. Is there another way to get the line items out of a contract?

Cheers,

Kristofer

Hi Kristoffer,

Not sure what else could be wrong. Could you try adding in the ‘offset’ and ‘limit’ fields? If this doesn’t work it may be worth trying the ‘get_entry’ call and using the ‘link_name_to_fields_array’ parameter.

Could you also provide an example of the return you are getting?

Thanks,
Jim

Jim,

I was able to solve it using the link_name_to_fields_array path. Thanks for the hint.

Cheers,

Kristofer