Community
Forma Developer Forum
Welcome to Autodesk Forma Developer Forum. Share your knowledge, ask questions, and explore popular Forma API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Update element

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
mostafa.elayoubi.ds
215 Views, 2 Replies

Update element

Hi there ! 

I'm looking for a way to update an element in the proposal by its urn or id but can't seem to find it. 

I see there is a way to update library items, but not the elements created via Forma.integrateElements.createElementHierarchy . 

Thank you for your attention! 

2 REPLIES 2
Message 2 of 3

Okay I think i figured out a way. 

I use addElement and store the path, then I use replaceElement . Is this the best way to do it? 

 

Thanks!

Message 3 of 3

Hi @mostafa.elayoubi.ds ! Sorry for the late reply, but looks like you found the solution already!

 

Here is a code example:

const urn = mockRegisterElementInSystem() // See e.g. integrate-elements module
const { path } = await Forma.proposal.addElement({ urn })
const newUrn = mockRegisterElementInSystem() // See e.g. integrate-elements module
await Forma.proposal.replaceElement({ path, newUrn })

The code example is also available in the SDK documentation here.

 

Best, Vilde in the Forma team 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Technology Administrators