Comments (1)
RE: Layouts. This is quite involved, but you can get the main parts of the process by referring to the Retrieve and Deploy demo VF pages and controllers, combine the logic in both of these and place in the middle code to read the layout via the Apex XML library and emit the new XML (via toXmlString() method) to deploy.
RE: Profiles. This in theory would be much the same process as above. However, the Salesforce Metadata API, makes it very hard to retrieve complete Profiles needed to implement such code. If you retrieve a Profile it is only partially complete depending on what else you retrieved, such as custom objects, fields, pages, classes etc. Meaning that in order to get permissions on such things included in the retrieve you also need to retrieve these items, which blows the 3MB callout response limit in Apex wide open.
I would recommend looking at the Permission Set API, which allows you to read Profile owned Permission Sets, from this you can create a new Permission Set (not profile owned). And then assign that to users. This is not the same as cloning a Profile, but has broadly the same effect and moves you closer to the much more flexible Permission Set based approach for managing permissions in an org.
from apex-mdapi.
Related Issues (20)
- Help article to use named credentials with wrapper has been removed HOT 1
- Generate an Apex from WSDL
- GlobalValueSetTranslation HOT 2
- Update search layout task, event, activity HOT 1
- System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element customizeSetup
- Apex Wrapper Metadata API Takes Time to Reflect the Change
- Can't create in production org
- Can't create a sharing rule HOT 2
- GlobalValueSetTranslation
- Can we create ApexClass natively? Any Example? HOT 1
- UserInfo.getSessionId() makes this unusable in packaged code HOT 2
- How do we update multiple profiles at once?
- LightningComponentBundle (LWC): reading/creating/updating
- Creating Apex Trigger
- Creating a MultiPicklist HOT 2
- System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element includeRecordsOwnedByAll
- How To get Picklist Value according to record type for a custom object HOT 3
- Can anyone suggest on how to read the flexipage? HOT 7
- Issue retrieving layout metadata for object via Metadata API HOT 1
- Row Lock Error - Updating the Picklist values in the Customer field and RecordTypes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apex-mdapi.