--- title: "State Actions" slug: "state-actions" description: "This is a list of State actions in the Org category that can be used in RapidIdentity Connect to interact with the State data for RapidIdentity Studio." tags: ["RapidIdentity ", "Connect", "Actions", "Org", "State", "Studio"] updated: 2022-06-03T19:06:12Z published: 2022-06-03T19:06:12Z canonical: "help.rapididentity.com/state-actions" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.rapididentity.com/llms.txt > Use this file to discover all available pages before exploring further. # State Actions ### getState Retrieves just one State. | Property | Value | Description | | --- | --- | --- | | id* | string | The ID of the State | ### getAllStates ```actionscript state = saveState({"name": "State 1", "code": 123456 state = getState(state.id) ``` Retrieves all States. If there are no existing states in the system, RapidIdentity will create one using a createState action set. | Property | Value | Description | | --- | --- | --- | | pageSize | integer | The page size (required for a paging request) | | pageNum | integer | The page number (defaults to 1 for a paging request) | ```actionscript states = getAllStates() stateId = " " if (states.length) < 1) { state = saveState({"name": "State 1", "code": 123456 stateID = state.id } else { stateId = states[0].id state = getState(stateID) ``` ### saveState Updates a State. | Property | Value | Description | | --- | --- | --- | | id* | string | The ID of the State | ```actionscript idautoStateRec = createRecord(false) addRecordFieldValue(idautoStateRec, 'name', stateName, false) addRecordFieldValue(idautoStateRec, "code", stateCode, false) idautoState = saveState(idautoStateRec) return idautoState ``` ### getStateRelationship Retrieves just one State relationship. | Property | Value | Description | | --- | --- | --- | | stateid* | string | The state ID of the State relationship | | user_id | expression | The user ID for the state relationships to retrieve | | role | string | The role of the state relationships to retrieve | ```actionscript stateRel = getStateRelationship(stateId, user_id) stateRelId = " " if stateRel.length < 1) { stateRel = savestateRelationship({"stateId": state.id, "userId": user_id, "role": ADMINISTRATOR } else { stateRelID = stateRel[0].id stateRel = getStateRelationship(stateRelId) } ``` ### getAllStateRelationships Retrieves all State Relationships. If there are no state relationships currently in the system, RapidIdentity will create one using a createStateRelationship action set. | Property | Value | Description | | --- | --- | --- | | stateId | string | The ID for which to fetch state relationships | | userId | string | The user ID for which to fetch state relationships | | role | string | The role for which to fetch state relationships | | pageSize | integer | The page size (required for a paging request) | | pageNum | integer | The page number (defaults to 1 for a paging request) | ```actionscript stateRels = getStateRelationships(stateId, user_id) stateRelId = " " if stateRels.length < 1) { stateRel = savestateRelationship({"stateId": state.id, "userId": user_id, "role": ADMINISTRATOR } else { stateRelID = stateRel[0].id stateRel = getStateRelationship(stateRelId) } ``` ### saveStateRelationship Updates a State Relationship. | Property | Value | Description | | --- | --- | --- | | stateId | string | The ID for which to fetch state relationships | | userId | string | The user ID for which to fetch state relationships | | role | string | The role for which to fetch state relationships | | pageSize | integer | The page size (required for a paging request) | | pageNum | integer | The page number (defaults to 1 for a paging request) | ```actionscript state = saveState({"name": "State 1", "code": 123456 stateRel = savestateRelationship({"stateId": state.id, "userId": user_id, "role": ADMINISTRATOR stateRel = getStateRelationship(stateRel.id) ``` ### deleteStateRelationship Deletes a State Relationship. | Property | Value | Description | | --- | --- | --- | | id* | string | The ID of the State Relationship | Delete by State Relationship id. ### deleteState Deletes a State. | Property | Value | Description | | --- | --- | --- | | id* | string | The ID of the State | Delete by State id.