Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Asset Object Custom Field with ability to Add a Record from the Request or Create Scree

Crystal Rouse
Contributor
March 8, 2024

I used to know how to do this and don't know if it was removed, but there was a way to configure a custom field that was an asset object and add in the option to allow the user to add a record from the Request Type and/or Create Screen.

I can't find this under the configuration anymore. Does anyone know how to do this?

1 answer

0 votes
shahshahzeb106_gmail_com
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 8, 2024

To create an "Asset Object Custom Field" with the ability to add a record from the request or create a new one, you can follow these general steps:

1. **Define the Custom Field**: Determine what kind of data you want to store in this custom field. For example, if you're using a database, you might want to create a field that references a specific table or entity.

2. **Create the Field in Your Data Model**: If you're using a database, add a new field to your asset object table to store the reference to the related record.

3. **Modify the User Interface**: In the request or create screen, add a section or field where users can select an existing record or create a new one.

4. **Implement the Selection Mechanism**: Depending on your platform or application framework, you'll need to implement the mechanism for users to select an existing record or create a new one. This could involve dropdown menus, search boxes, or modal dialogs.

5. **Handle the User Input**: Once the user selects an existing record or creates a new one, you'll need to handle the input and update the value of the custom field accordingly. This might involve making database updates or triggering API calls to create new records.

6. **Display the Selected Record**: Finally, make sure that the selected record is displayed correctly in the request or create screen, so users can see what they've chosen.

Here's a simplified example using a web application:

```html
<!-- HTML for the selection mechanism -->
<select id="asset-selection">
<option value="existing">Select Existing</option>
<option value="create">Create New</option>
</select>

<!-- HTML for the create form -->
<form id="create-form" style="display: none;">
<input type="text" id="new-asset-name" placeholder="Enter Asset Name">
<button type="button" onclick="createAsset()">Create</button>
</form>

<script>
// JavaScript to handle user input
document.getElementById("asset-selection").addEventListener("change", function() {
var selection = this.value;
if (selection === "create") {
document.getElementById("create-form").style.display = "block";
} else {
document.getElementById("create-form").style.display = "none";
}
});

function createAsset() {
var assetName = document.getElementById("new-asset-name").value;
// Logic to create a new asset record
// This might involve making an API call or updating the database
}
</script>
```

This is a very basic example and may need to be adapted to fit your specific requirements and technology stack. If you're working within a specific platform or framework, there may be built-in tools or libraries that can help you implement this functionality more easily.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events