Developer forum

Forum » CMS - Standard features » Withdraw consent

Withdraw consent

Lars Larsen
Lars Larsen
Reply

Hi

Is it possible to withdraw a consent from the frontend? If so, what has to be setup in the backend.


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Lars,

Yes, it's possible to withdraw consents from the front end, but you'll have to implement some of it in a razor template, because there's currently no app for this.

Example:

// Activity id
var activityId = "abb52fc1-eb66-4bbb-8f78-2b3cd047c44e";
var activity = Consents.GetActivity(activityId);

// Withdraw consent to an activity (current user)
Consents.User.WithdrawConsent(activity.Id);

// Withdraw consent to an activity (current visitor)
Consents.Visitor.WithdrawConsent(activity.Id);

You can find more details and other methods in the api docs for ConsentManager.

And instead of using a hard coded activity id you could get that value from an item field.
This can be done by creating a new list field (dropdown) with SQL options (SELECT ActivityId, ActivityName FROM DataProcessingActivity) with "ActivityName" as label and "ActivityId" as value.

Best regards,
Morten

 

Votes for this answer: 1

 

You must be logged in to post in the forum