0

In an attempt to bulk create a large sum of URL redirects I am wondering if there is a way to do so via apex?

I have tried running the below code but it throws an exception, DML operation Insert not allowed on SiteRedirectMapping.

SiteRedirectMapping siteRedirectMapRecord = new SiteRedirectMapping();
siteRedirectMapRecord.SiteId = 'ID11s0000000123ABC';
siteRedirectMapRecord.Source = '/test-source';
siteRedirectMapRecord.Target = '/s/test-target';
siteRedirectMapRecord.Action = 'Permanent';
siteRedirectMapRecord.IsActive = true;
insert siteRedirectMapRecord;

If there was some client-side/JS workaround, I'd take that too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.