Giter Site home page Giter Site logo

Comments (6)

afawcett avatar afawcett commented on July 30, 2024

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.

afawcett avatar afawcett commented on July 30, 2024

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.

mohit-address avatar mohit-address commented on July 30, 2024

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.

mohit-address avatar mohit-address commented on July 30, 2024

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.

afawcett avatar afawcett commented on July 30, 2024

That's great I will update the example code so others can see how update works. Glad you got it working!

from apex-mdapi.

vinay-sv-sol avatar vinay-sv-sol commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.