--- type: "fhir-fhirpath-function" title: "FHIR FHIRPath Function: %factory.withExtension" source: "source/fhirpath.html" --- # FHIR FHIRPath Function: %factory.withExtension This page is part of **FHIR FHIRPath** (FHIR-specific extensions). Base spec lives at [FHIRPath](/fhirpath). `%factory.withExtension(instance : T, url : string, value) : T` Add an extension, and return the new type: `%factory.withExtension(%factory.create(Money), 'http:/acme.com/extension/example', %factory.code('test'))` Parameters: - **instance**: The instance to add the URL to - **url**: a string value that goes in Extension.url - **value**: the value of the extension **Return Value:** A copy of the instance of the type with the extension added. Extensions that already exist with the same url are not removed. * * * [Back to FHIR FHIRPath](/fhir-fhirpath)