Comments (6)
Great, thanks for the feedback. Are you using the MetadataService.cls from the repo or have you generated your own? If you generated your own perhaps the class name is not the same? You should have a class called MetadataService with an inner class call MetadataWithContent inside it. If you have generated your own please attach it and I will take a look. I only give the instructions at the bottom incase you want to generate again from the WSDL in the future, the class in the repo is currently the latest. Good luck and let me know how you get on! I would love to know more about how you are making use of this! Cheers!
from apex-mdapi.
Take a look at the MetadataServiceExamples.cls for a createObject example. As regards handling the AsyncResult you can see how I am doing this via the MetadataServiceController and related page, basically using an apex:actionPoller.
from apex-mdapi.
Hi .
Yes i created my own class from wsdl from scratch .
i just compared it with your class and found error . just a minor issues on defining class . done now . can create object and field .
although i came across something .
__Update() call or UpdateMetadata() call in our case . requires an attribute : current name
how are we passing that ? __
eg : I have created a text field on Lead object by name: test..c , length :18 , label: test field
and now i want to change length to 16
Now as per document . I need to call update () metadata api . with current name :Lead.test..c
i tried to poke around with some hit and try but could not get to update field via updateMetadata()
any thoughts on That
from apex-mdapi.
Done updating field : hear is the code example :
Hope this may help a bit ....
public static void createField()
{
MetadataService.MetadataPort service = createService();
MetadataService.CustomField customField = new MetadataService.CustomField();
customField.fullName = 'lead.number__c';
customField.label = 'number';
customField.type_x = 'Number';
customField.scale= 0;
customField.precision= 11 ;
MetadataService.AsyncResult[] results = service.create (new List<MetadataService.Metadata> { customField });
}
public static void updateField()
{
MetadataService.MetadataPort service = createService();
MetadataService.CustomField customField = new MetadataService.CustomField();
customField.fullName = 'lead.number__c';
customField.label='new_label';
customField.type_x = 'Number';
customField.precision= 10 ;
customField.scale=0 ;
MetadataService.UpdateMetadata ut = new MetadataService.UpdateMetadata();
ut.currentName='lead.number__c';
ut.metadata= customField;
MetadataService.AsyncResult[] results = service.updateMetadata(new List<MetadataService.updateMetadata> {ut});
}
from apex-mdapi.
That's great I will update the example code so others can see how update works. Glad you got it working!
from apex-mdapi.
i am also getting this exception "Initial expression is of incorrect type, expected: MetadataService.Metadata" while creating button How can i Resolve this
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.