I have been facing an issue while updating Ad Creative URL tags.
I knew that we can't update URL tags for already existing Ad Creative.
So, I tried to clone existing one with modified URL tags and tried to remove old one but deleting create issues and now I'm getting this error.
You cannot delete this creative because it is currently in use for existing adgroups
Tried to change ad status to "DELETED" but that also don't works. Also, tried to change the Ad status to "PAUSED" but no luck at all. Even API don't update Ad status.
Anyone, please guide me what to do to resolve this? Or any other way through which I can update Ad Creative URL tags?
I am using PHP SDK and following this FB documentation. I have all required permissions for my application and also they are approved by FB.
I successfully did this by following these steps
Following is the PHP code I used to fix this issue.
$newObj = new AdCreative(null, 'act_account_id');
$newData = [];
$fields = [
AdCreativeFields::NAME,
AdCreativeFields::TITLE,
AdCreativeFields::BODY,
AdCreativeFields::OBJECT_URL,
AdCreativeFields::LINK_URL,
AdCreativeFields::IMAGE_HASH,
AdCreativeFields::OBJECT_STORY_ID,
AdCreativeFields::OBJECT_STORY_SPEC,
AdCreativeFields::URL_TAGS,
];
foreach ($fields as $field) {
$value = $oldAdCreative->{$field};
if(isset($newValues[$field])){
$value = $newValues[$field];
}
$newData[$field] = $value;
}
$newObj->setData($newData);
$newObj->create();
// Assigning New Creative ID to Ad
$ad = new Ad($adId);
$ad->update(array(
'creative' => ['creative_id' => $newObj->{AdCreativeFields::ID}],
'redownload' => true,
));
Done.