Hi Amelie,
There is an entity Listmember which saves all mapping records between contact and marketing list.
e.g:
List A contains 3 memebers, list B contains 2 members, thus there will be 5 listmember records in system.
Listid Memberid
• List A id contact 1 id.
• List A id contact 2 id.
• List A id contact 3 id.
• List B id contact 1 id.
• List B id contact 2 id.
If there is a listmember record which its listid field equal to list B id and its memberid field equal to contact 1 id,
then it indicates that conact 1 is part of list B
Thus we could do it with JavaScript:
Create a JScript web resource with code below and add it to Contact form.
function listmemberChecker(executionContext) {
var formContext = executionContext.getFormContext();
// Get current contact id
var id = formContext.data.entity.getId().replace(/\{|\}/gi, "").toLowerCase();
// Check whether there is association between contact and the specific marketing list
var query = "?$filter=_listid_value eq '006552d4-7eb6-ea11-a812-000d3ab64f2b' and _entityid_value eq " id "";
Xrm.WebApi.retrieveMultipleRecords("listmember", query).then(
function success(result) {
if (result.entities.length > 0) {
formContext.getAttribute("xxx").setValue("some value");
}
},
function (error) {
console.log(error.message);
}
);
}
We can get a subscription list id in URL.

If retrieved result length is larger than 0, then set a certain field to a certain value.
Please take tutorial below for how to add a javascript web resource to form.
https://carldesouza.com/how-to-use-formcontext-in-a-web-resource-in-dynamics-365-power-apps/
Regards,
Clofly